A special note of thanks to Joe Comeau for inspiring me to research this
step one – create a directory in the wp-content/plugins directory:
mkdir ./wp-content/plugins/markTest
step two: create a php file – in this example markTest.php:
<?php
/*
Plugin Name: Marks Test
Plugin URI: http://URI_Of_Page
Description: A brief description of Plugin.
Version: The Plugin’s Version Nbr
Author: Name Of The Plugin Author
Author URI: http://edwardsmark.com
License: A “Slug” license name e.g. GPL2
*/
//add_action(‘wp_footer’, ‘marks_function’);
add_filter(‘the_content’, ‘marks_function’);
function marks_function($content){
. . .$content .= ‘TEST TEST TEST’;
. . .return $content;
}
?>
this plug-in will insert text at the end of every page. the parameter ‘the_content’ is for every page, ‘wp_footer’ is for the footer, etc.
add_action and add_filter are very similar.
add_action is actually a wrapper function for add_filter:
function add_action($tag, $function_to_add, $priority = 10, $accepted_args = 1)
{
. . .return add_filter($tag, $function_to_add, $priority, $accepted_args);
}
very good references:
http://codex.wordpress.org/Plugin_API
http://codex.wordpress.org/Function_Reference/add_filter
very good article i wish i had seen before starting to write a plug-in