WordPress as many of our readers would be familiar with is a very versatile platform that can serve many a purposes. What makes WordPress so versatile is the fact that a number of different themes and Plugins are available for WordPress that help to achieve various different kinds of functionality. Today we will have a look into the WordPress Plugins and how these are developed, to be more specific.

First of all, a plug-in is basically a piece of code that hooks on to the WordPress install and serves to add some new functionality or purpose over and above that provided by WordPress itself. A plug-in can e defined as a tool that extends the functionality provided by WordPress by offering custom functions and features so that the users may tailor their websites as per their specific requirements.

Let us now understand the anatomy of a wordpress plug-in. A plug-in consists of one or more functions and or lines of code written in PHP scripting language and aims to achieve a particular functionality. To create a plug-in first of all a unique name must be chosen for it and even better if the name somewhat suggests about the plug-ins functionality. After this first of all a PHP file needs to be created with any chosen but unique name as this file will be put in   wp-content/Pluginsdirectory and must not conflict with the files of the other Plugins. A plug-in can have one or more PHP files, CSS, JavaScript, image and language files. In case of multiple files a unique directory name is chosen and all the files are packed into this and the whole pack is then installed under the wp-content/Plugins under WordPress. It is also advised to create an online page for the plug-in that may help the users understand the intended functionality of the plugin and its features.

The main plug-in file must contain standards plug-in information header. Please see a sample below:



* 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 plugins’ 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


The rest of file should make use of PHP coding, WordPress template tags and plugin hooks coding.

A brief introduction to hooks and template tags:

WordPress Plug-in hooks: The these work is that at different times while the WordPress is running WordPress checks if any plug-in has registered functions to be run at that time and if true the functions are executed. For instance, before WordPress adds the title of a post to browser output, it first checks to see if any Plugin has registered a function for the “filter” hook called “the title”. If so, the title text is passed in turn through each registered function, and the final result is what is printed.

Template Tags: A template tag is used within the WordPress templates and can be defined as a piece of code that instructs word press to do something or fetch some information. For example single_post_title() displays or returns the title for a single post.

Finally we would like to say that plug-in should be coded with the right mix of the desired elements to meet the requirements . We hope that this article helps the readers to understand the basics of WordPress plug-in development.

1Solutions is a certified WordPress designing & development company in New Delhi, India. We are providing WordPress development services, corporate websites, responsive website development services, logo design, website design services, application development & internet marketing services across the world.