WordPress is great and most used open source CMS in web world.Its mostly use for blog system but you can create website and typical dynamic website also. its very easy to use and customized.Wordpress has rich plug-in pool but may be it will not fulfill your requirement, to solve this problem wordpress introduced plug-in management systems with use of this you can build their own custom plug-in to add new features.
WordPress Plugging allow easy modification, customization, and enhancement to a WordPress blog. Instead of changing the core programming of WordPress, you can add functionality with WordPress Plugging.
Word press plugin is a simple program, a set of functions, that adds a specific set of features and services that can be executed in different sections of your WordPress site.
Writing a wordpress plugin is not difficult task, its 2 steps work. The plugin has two parts:
- The plugin header information
- The code for the plugin
In this tutorial i am going to make a simple plugin which will show message on wordpress footer area.
Step 1:First will create ‘wp-test-hello’ folder under “wp-content\plugins\” directory.
Step 2: Now we will create wp-test-hello.php file to write plugin functionality.
The Header Information
Each plugin main PHP files must have standard Plugin information header.Header information tells wordpress Plugin exists add it to the Plugin management screen so it can be activated, load it, and run its functions; without the header, your Plugin will never be activated and will never run.
/*
Plugin Name: Name Of The Plugin
Plugin URI: http://URI_Of_Page_Describing_Plugin_and_Updates
Description: A brief description of the Plugin.
Version: The Plugin's Version Number, e.g.: 1.0
Author: Name Of The Plugin Author
Author URI: http://URI_Of_The_Plugin_Author
License: A "Slug" license name e.g. GPL2
*/
?>
code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
<?php /* Plugin Name: fotter_hello Plugin URI: http://URI_Of_Page_Describing_Plugin_and_Updates Description: simple wordpress plugin display in fotter msg. Version: 1.0 Author: parvez Author URI: http://URI_Of_The_Plugin_Author License: GPL2 */ ?>
The plugin code:
Now we will write below code in plugin main side and hooks with wp_footer area.
1 2 3 4 5 6 7
add_action('wp_footer','addHello');
function addHello() {
echo 'Hello! wordpress';
}
