WordPress Plugin Development Boilerplate

Another contribution to the open-source community. We have developed and released a boilerplate template to develop a new WordPress plugin using Object Oriented Programming (OOP) approach. If you are a WordPress developer and want to develop a custom WordPress plugin from scratch, then this boilerplate may act as a good starting point for your new WordPress plugin.

Folder Structure

The boilerplate code is very well structured and organized into folders based on the type of functionality. Following is the folder structure of the boilerplate plugin:

  • assets
    • images
    • css
    • js
  • includes
    • admin
      • class-codowppb-admin.php (handle admin-specific functionality)
    • common
      • class-codowppb-common.php (handle common functionality for both admin and frontend)
    • public
      • class-codowppb-public.php (handle public facing functionality)
    • class-codowppb.php (handle core functionality of the plugin)
  • codowppb.php (main plugin file)
  • index.php
  • LICENSE.txt
  • README.md
  • README.txt
  • uninstall.php

As can be seen from the folder structure that we have organized the folders and classes so that the functionality is loaded conditionally based on the requirements. This feature makes the plugin more organized and optimized in terms of performance.

Features

  • Object Oriented Programming (OOP) approach
  • Folders and Classes are organised based on the type of functionality i.e. public-facing or admin-specific
  • Assets (CSS and JS) are included and properly enqueued for admin, public, and common functionality
  • Admin settings page functionality is also added to add an admin page menu for the plugin

How To Use It?

  • Clone/download the github repository inside the wp-content/plugins folder
  • Replace the ‘codowppb’ word with your plugin name in all files, file names or folder names etc.
  • Add/modify the relevant codes according to your custom requirements

The boilerplate plugin is hosted on GitHub as a public repository and will be updated with more features soon. The suggestions and recommendations are welcome! Thanks

Leave a Comment