LATEST >>

Welcome Here And Thanks For Visiting. Like Us On Facebook...

EXEIdeas – Let's Your Mind Rock » Guest Post / WordPress / WordPress Tricks » Step By Step Guide To Learn WordPress Plugin Development

Step By Step Guide To Learn WordPress Plugin Development

Step-By-Step-Guide-To-Learn-Wordpress-Plugin-Development
There is a great craze about WordPress plugins among all those people who use WordPress websites to market their businesses, make people aware of their products and services, and make revenues. WordPress plugins allow them to add the desired features and functionalities to WordPress websites/blogs without writing a single code, improve their work productivity greatly and meet the needs of a large number of customers. So, there is a great demand for different WordPress plugins.

A good number of technicians create awesome WordPress plugins and earn handsome money by selling them to the needy clients. So, do you want to adopt WordPress Plugin development as your first career choice? Do you want to know how to develop WordPress Plugins? If yes, then read out the below-mentioned guidelines.

Download WordPress On Your System:

To create a new WordPress plugin, first of all, you need to download WordPress on your system. Just go to the WordPress.org and click the download link. Once the WordPress is downloaded, you can move to the next step to create a new WordPress plugin.

Give A Name To Your Plugin:

Always keep in mind that plugins are situated in XYZwpwp-contentpluginsWordsuccor_plugin. Create a folder for this in the plugin directory. Give a name to your file. Make sure the plugin name must reflect its main work or business. So, think and choose its name carefully.

As you see in the above image, Wordsuccor_plugin doesn’t exist. So, now you need to write the following text into this file. After that, you start to see your plugin in the admin panel of WordPress.

<?php/* Plugin Name: Wordsuccor plugin
Plugin Description: Plugin for testing purpose
 Version: 1
Author:wordsuccor
Author URI: https://www.wordsuccor.com */?>

Once the plugin is activated, you are supposed to create a menu to display it I the admin panel. For that that you need to create a few static HTML files.

Define File Paths:

Now, you need to encode PHP. First of all, definite the paths for the CSS or JS files that will be used in the plugin. Fr instance, create a style.css file and put it in the css folder. You also need to inform the path shortcodes-toolbox / css / style.css Keep changing the shortcodes-toolbox.php file and add WP paths:

if(!defined('WP_CONTENT_URL'))
  define('WP_CONTENT_URL', get_option('siteurl') . '/wp-content');
if(!defined('WP_CONTENT_DIR'))
  define('WP_CONTENT_DIR', ABSPATH . 'wp-content');
if(!defined('WP_PLUGIN_URL'))
  define('WP_PLUGIN_URL', WP_CONTENT_URL. '/plugins');
if(!defined('WP_PLUGIN_DIR'))
  define('WP_PLUGIN_DIR', WP_CONTENT_DIR . '/plugins');
class STbox {
  function cssStyles() {
   $stPath = WP_PLUGIN_URL.'/'.plugin_basename(dirname(__FILE__)).'/styles/'.'/';
   echo '<link rel="stylesheet" type="text/css" media="screen" href="' . $stPath . 'style.css" />'."\n";
  }
}

Plugin Functionality:

This is the most important step of WordPress plugin creation. Just add functionality to your plugin, such as a custom download button, links to related entries, etc. Always keep in mind that a plugin can perform many functionalities. So, based on your specific needs, you need to add functionalities to the WordPress plugin you are creating.

Learn-WordPress-Plugin-Development

Action Hooks:

In simple words, action hooks enable you to add extra code to WordPress core or theme. With its help, you can add new functionalities to your website and customize the site as per your needs. For example- You have to create an employee list. For that, just a file named employee_list.php

<?php
function employee_list() {
  ?>
  <style>
    table {
      border-collapse: collapse;
    }
    table, td, th {
      border: 1px solid black;
      padding: 20px;
      text-align: center;
    }
  </style>
  <div class="wrap">
    <table>
      <thead>
        <tr>
          <th>No</th>
          <th>Name</th>
          <th>Role</th>
          <th>Contact</th>
        </tr>
      </thead>
      <tbody>
        <tr>
          <td>1</td>
          <td>Hardik K. Vyas</td>
          <td>Php Developer</td>
          <td>+91 940894578</td>
        </tr>
        <tr>
          <td>2</td>
          <td>Mark M. Knight</td>
          <td>Blog Writer</td>
          <td>630-531-9601</td>
        </tr>
        <tr>
          <td>3</td>
          <td>Annie D. Naccarato</td>
          <td>Project Leader</td>
          <td>144-54-XXXX</td>
        </tr>
        <tr>
          <td>4</td>
          <td>Jayesh P. Patel</td>
          <td>Web Designer</td>
          <td>+91 98562315</td>
        </tr>
        <tr>
          <td>5</td>
          <td>Alvin B. Reddick</td>
          <td>ifone Developer</td>
          <td>619-11-XXXX</td>
        </tr>
      </tbody>
    </table>
  </div>
  <?php
}
?>

And add following code to Wordsuccor_plugin.php file as shown here below:

<?php
/*
 Plugin Name: Wordsuccor plugin
 Description: Plugin for testing purpose
 Version: 1
 Author: Wordsuccor
 Author URI: https://www.wordsuccor.com
*/
add_action('admin_menu', 'at_wordcussor_menu');
function at_wordsuccor_menu() {
  add_menu_page('employee_list', //page title
      'Employee Listing', //menu title
      'manage_options', //capabilities
      'Employee Listing', //menu slug
      employee_list //function
  );
}
?>

Now, you need to refresh the WordPress and activate the plugin.

CSS Styles

You need to add CSS styles if you want to create excellent boot buttons. Just Open the style.css file and add the following lines-

.green a:link, .green a:visited{
color:#ffffff;
text-decoration:none !important;
}
.black a:link, .black a:visited{
color:#ffffff;
text-decoration:none !important;
}
.green a:hover, .black:hover{
color:#ffffff;
text-decoration:none !important;
}
.green {
display: inline-block;
font-weight:bold;
font-size:1.2em;
background : -webkit-gradient(linear, left top, left bottom, from(#88c841), to(#73b338));
background : -moz-linear-gradient(center top, #88c841, #73b338);
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
padding: 5px 20px;
text-align: center;
-shadow: 0px 1px 0px #6c0909;
color:#ffffff !important;
text-decoration:none !important;
}
.green:hover {
background : -webkit-gradient(linear, left top, left bottom, from(#73b338), to(#88c841));
background : -moz-linear-gradient(center top, #73b338, #88c841);
color:#ffffff !important;
text-decoration:none !important;
}
.black {
display: inline-block;
font-weight:bold;
font-size:1.2em;
background : -webkit-gradient(linear, left top, left bottom, from(#000000), to(#414141));
background : -moz-linear-gradient(center top, #414141, #000000);
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
padding: 5px 20px;
text-align: center;
-shadow: 0px 1px 0px #6c0909;
color:#ffffff !important;
text-decoration:none !important;
}
.black:hover {
background : -webkit-gradient(linear, left top, left bottom, from(#414141), to(#000000));
background : -moz-linear-gradient(center top, #000000, #414141);
color:#ffffff !important;
text-decoration:none !important;
}

Installation And Testing:

Now, you need to check the newly created WordPress plugin for its functionalities. Create a zip archive, put the folder shortcodes-toolbox and load it into WordPress using the admin panel (Plugins-> Download). After the successful installation of the plugin, create a new record or page and add the following lines for testing:

[DownloadButton url="http://www.google.com" color="black"]Download Google Chrome[/DownloadButton]
[link href="http://www.yahoo.com"]Yahoo[/link]

If your plugin is working smoothly, then its fine. If not, you need to consult a WordPress Plugin development company and get the problem resolved as soon as possible.

Final Words:

Different WordPress plugins are in great demand because of the growing use of the WordPress CMS. Just follow the above-mentioned tips to learn the art of WordPress plugin creation, provide WordPress Plugin development services to all the needy clients and customers and make lots of revenues every month.

Marie ThomasAbout the Author:

This Post is written by Marie Thomas. She is an expert wordpress developer and a Writer by hobby. She works with the top WordPress development company – WordSuccor Ltd. She has write many blogs on WordPress Plugin development.

Find Me On GooglePlus

You Like It, Please Share This Recipe With Your Friends Using...

2 Responses to “Step By Step Guide To Learn WordPress Plugin Development”

  1. peng says:

    WordPress plugin is very helpful to people who knows little code. thanks for sharing, I learned more about it.

Leave a Reply

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