Php Flow » Php

Simple WordPress Plugin Tutorials

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-plugin-image


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';
		}
Did you enjoy this article? Share it!

About the Author:

Hi, This is Parvez Alam from India. I am software developer with 4 years’ experience in web development. I have submitted articles on PHP, Mysql, Magento,CSS, HTML, jQuery, web designing and social API. You can subscribe to my blog via RSS/Twitter/Google plus and Facebook. parvez1487(at)gmail(dot)com

Random Posts

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>