Building a custom plugin in wordpress

Building a custom plugin in wordpress

WordPress is a very powerful CMS with a huge set of features. What makes WordPress extremely powerful is its ability to modify, extend and add new features using plugins. The wordpress repository is full of a large variety of plugins to satisfy almost each and every requirement of a website owner. But there are cases where you need certain functionalities for which a plugin has not been written.  In such a scenario you can always write your own plugin and add the functionality as per your requirement. It is super easy to create a plugin in wordpress all by yourself.

Below is a step-by-step guide of getting started with WordPress plugin development:

  • The plugins in wordpress are stored in /wp-content/plugins folder. To create a new plugin, create a folder inside the plugins folder. Here we will name it as test. So now we have a folder /wp-content/plugins/test. Our plugin code will reside inside this folder.
  • Now we create the main php file containing our plugin code. We name it as test.php
  • For the file to be recognized as a plugin file, we need to add a few comments at the beginning of the file:

/*

Plugin Name: test

Plugin URI: www.test.com

Description: Test plugin description

Author: abc

Version: 1.0

*/

 

  • Once this is done, save the file and log into the wordpress admin panel. The url would be something like www.yoursite.com/wp-admin
  • Navigate to plugins option and activate your plugin.

With this you have created your basic custom wordpress plugin. You can go ahead and add the functionality that you want in your test.php file. You can add functions in this plugin and create a hook to invoke that function or you can simply call that function from the core file of your wordpress CMS.

Stay tuned for more information on these topics

 

 

 

  • Priyanka Thorve

    Good Work Roshni 🙂

Comments are closed.