creating wordpress plugin

One of the main reasons WordPress is such a popular software platform is the ease with which it can be extended. Plugins are the primary reason for this and allow almost endless possibilities in extending WordPress.
For creating wordpress plugin first of all we have to create a folder in our plugin folder under the Websites root directory wp-content
for example suppose we have to create a plugin named myPlugin then the folder structure will be as :

<strong>website root\wp-content\plugins\myPlugin</strong>

File Organization

Keeping your plugin files organized is a key step in producing a professional plugin. Generally speaking, you should have only two files in your plugin folder: the primary plugin PHP file and your uninstall.php file. For organizational reasons, store all other plugin files in a sub directory.
It is also recommended you split your plugin into several smaller files. One primary reason for doing so is for performance reasons. For instance, you should group all admin interface functions in a separate file. This allows you to conditionally include the admin code only when the user is viewing the admin side of WordPress:

if (is_admin()) 
	// we’re in wp-admin
	require_once( dirname(__FILE__).'/includes/admin.php' );

The preceding example uses the is_admin() conditional statement to verify the user is in the admin dashboard of WordPress. If so your plugin should include and process the /includes/admin.php file for your plugin.


You may also like...

No © Loop and Break