fbpx

WordPress Plugin Development for Beginners

First, it’s important to understand how WordPress plugins fit into the WordPress Content Management System. Plugins provide nearly infinite extensibility and allow you to add countless features to your WordPress website.

Would you like to learn more about WordPress Plugin Development and save some time? You can go through our WordPress Plugin Development video course or be notified when other WordPress Plugin Development courses are available by signing up for our WP Plugin newsletter by clicking on the button below:

Sign Up for Our WP Plugin Video Course

For example, we built a plugin called WPMerchant which allows you to collect payments on your WordPress site or turn it into a membership site.

We love being able to build plugins for our passion projects and we love empowering others by teaching them our tips to make the whole process easier and simpler. Plugins provide anyone the ability to add functionality to their WordPress site and there are numerous plugins that have turned into profitable business ventures. For example, WooCommerce reportedly sold to Automattic for $30 Million. Maybe you have the next big idea!

WordPress Plugin Boiler Plate (WPPB)

It’s hard to know where to start in terms of WordPress Plugin Development. We typically suggest referencing the WordPress documentation, but it would be limiting in this case. If you decide to go through the WordPress documentation, you will soon realize that they don’t offer any structure for plugins, instead, they just provide a description of the minimum file structure and content needed to create a plugin.   The WordPress Plugin Boilerplate (wppb.io) on the other hand is much more full-featured and makes it easy for you to maintain and grow the features of your plugin.  It’s meant for people who are serious about their plugin, people who are building it for their business, for a client, or to sell/license to others. WPPB provides an excellent framework necessary to organize the different parts of your plugin. 

WPPB File/Directory Structure

However, it can be difficult to figure out how everything fits together. They don’t provide a very good breakdown of the function of different directories or files. So, we’re going to do it for you! Here are the files and directories of WPPB:

  • admin
    • css
    • js
    • partials
    • class-plugin-name-admin.php
    • index.php
  • includes
  • languages
  • public
    • css
    • js
    • partials
    • class-plugin-name-public.php
    • index.php
  • LICENSE.txt
  • README.txt
  • index.php
  • plugin-name.php
  • uninstall.php

The two most important directories structurally are the admin and public directories. They organize your code in a basic but very important way.  This structure ensures that you don’t end up with spaghetti code which significantly speeds up your development time.

Admin Directory

The admin directory organizes all of the style, structure, and features that you would like to be present on the WordPress admin dashboard. In order for a user to access these features, they must be logged into the WordPress site. Some examples of admin related actions include (there are endless capabilities):

  • adding a shortcode
  • adding a Plugin settings page (including styling, saving settings, etc.)
  • adding a custom post type
  • adjusting the WordPress editor

An image of one page from the admin side of a plugin can be seen below:

This is the WPMerchant Plugin Settings Page and the code for the look and function of this page exists in the WPPB admin directory

Public Directory

The public directory organizes all of the style, structure, and features that you would like to be present on the actual WordPress website that your customers visit. In order for a user to access these features, they can just visit your website, and don’t need to be logged into the WordPress site. Some examples of public related actions include (there are endless capabilities):

  • A form to accept Customer Payments
  • A button to share your post on Twitter, Facebook, etc.
  • A gallery for your Videos

An example of this is visible in the following screenshot:

Download and Setup WPPB 

Enough chit-chat, let’s set up your WordPress plugin! You could download it from wppb.io but we have found that the WPPB.me website saves us a significant amount of time.

Download Your WordPress Plugin

So, click on the button above, enter in your details, and submit the form.  It will download a copy of the WPPB code, but everything will be named based on what you entered into the form instead of the default plugin-name information set in the WPPB.io download (this renaming will save you a ton of time).  

Now that you have downloaded your new plugin, you can start getting to the fun part and actually plan out what all you want for your plugin.  We’re going to introduce you to how to use your new WordPress Plugin Boiler Plate plugin by showing you how to create a shortcode. Create your first WordPress shortcode by clicking on the button below:

Create a WordPress Shortcode

Would you like to learn more about WordPress Plugin Development and save some time? You can go through our WordPress Plugin Development video course or be notified when other WordPress Plugin Development courses are available by signing up for our WP Plugin newsletter by clicking on the button below:

Sign Up for Our WP Plugin Video Course

Leave a Reply

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