Echo simple string in Plugin

I am getting started with plugin development. I wrote the following program to display text on screen but nothing happened. Please help. Thanks.

<?php
/*
Plugin Name: Fahad
Plugin URI:
Description: Declares a plugin that will be visible in the
WordPress admin interface
Version: 1.0
Author: Yannick Lefebvre
Author URI: http://ylefebvre.ca
License: GPLv2
*/
?>


function fahad(){
    echo "I am alive";
}
add_filter('wp-footer', fahad);

1 Answer
1

A subtle difference between your syntax wp-footershould be wp_footer, underscore _ and not hypthen -

add_filter('wp-footer', fahad);   // wrong...

add_filter('wp_footer', 'fahad'); // right..

Follow the naming convention of functions:

  • (Codex) Plugin_API: Action_Reference » the wp_footer hook
  • (Codex) Plugin_API: Action_Reference
  • (Codex) Function_Reference

Leave a Comment