How to Create Site-Specific WordPress plugin

WordPress is one of the best content management system everyone knows that, it let’s you customize each single code within your site for your ease. Recently, I was redesigning Softstribe and came across many errors like, sidebar disappearance, header missing and so on because we have custom codes in theme functions.php which was causing problems. Sooner we realized it and decided to create site-specific WordPress plugin to prevent errors.

Make sure you don’t put mess amount of custom functions in your functions.php file of your theme because it not good practice. When you do development with your custom codes it is better to create separate plugin for that and here is how we do this.

Create site-specific wordpress plugin

How to create site-specific WordPress plugin

Following are the steps that you have to follow in order to create site-specific WordPress plugin:

  • Login to cPanel and navigate through public_html to your WordPress installation
  • Go to wp-content/plugins and create a new folder in the plugins directory.
    Example: /wp-content/plugins/yoursitename-plugin/
  • With the same folder name. you have to create php file inside of that new blank plugin folder
    Example: “yoursitename-plugin.php”
  • Put the following code in the file:
<?php
/*
Plugin Name: Site Plugin for smashingwp.com
Description: Site specific code changes for smashingwp.com
*/
/* Start Adding Functions Below this Line */


/* Stop Adding Functions Below this Line */
?>

Once, you are done here… Login to your WordPress blog and go to plugins where you will see your plugin in inactive state. Simply, click on activate link to activate the plugin.

Note: All you have to make sure that you don’t have function names similar or exactly same as of your theme because that will conflict the site. Just create your own unique functions to put inside of your site-specific plugin.

Last but not the least, we hope that our guide helped you out though the custom WordPress development and if it did be sure to comment below.

Leave a Reply

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