2021-10-06 14:04:18 -06:00
2022-09-30 14:43:10 -06:00
2021-06-02 11:05:08 -06:00
2022-09-30 12:37:17 -06:00
2023-03-09 13:08:18 -07:00
2023-03-09 13:01:01 -07:00
2022-09-30 12:54:30 -06:00
2022-09-30 12:54:14 -06:00
2022-09-30 13:09:37 -06:00
2023-07-28 14:24:55 -06:00
2023-07-28 14:24:55 -06:00
2022-09-30 12:54:37 -06:00
2021-10-06 09:56:53 -06:00

Boilerplate WordPress Plugin

A starter plugin based on my own experience.

Installation

Requirements

This theme requires the following dependencies:

Quick Start

Clone or download this repository then change its name to something else such as {namespace-}amazing-plugin. Next you'll need to edit or rename various files to give your new plugin a proper naming scheme. All files are referenced from the root of the

First, change the "name", "version", "author", "license", and any other relevant fields in /composer.json and /package.json.

As an example, let's use Stark as the namespace and Alloy as the plugin name. First, I would rename the base directory from nmsp-plugin-name to strk-alloy. Then I would search for the following and replace them as such:

Search: Replace
NMSP_PLUGIN_BASE_DIR STRK_ALLOY_BASE_DIR
nmsp-plugin-name-text-domain strk-alloy-text-domain
Namespace Plugin Name Stark Alloy
nmsp_plugin_name_menu strk_alloy_menu
nmsp-plugin-name-menu-slug strk-alloy-menu-slug
NMSP_PLUGIN_NONCE STRK_ALLOY_NONCE
NMSP_PLUGIN_SLUG_REWRITE_NAMES STRK_ALLOY_REWRITE_NAMES
NMSP_PLUGIN_SLUG_PAGE_NAME STRK_ALLOY_PAGE_NAME
nmsp_plugin_slug_page_name strk_alloy_page_name
PluginNamespace Stark
PluginNamespaceTests StarkTests
nmsp-plugin-name-menu-slug strk-alloy-menu-slug
Namespace Plugin Name Stark Allow
nmsp_plugin_name_settings_title strk_alloy_settings_title
nmsp_plugin_app strk_alloy_app
nmsp-plugin-admin-css strk-alloy-admin-css
nmsp-plugin-admin-js strk-alloy-admin-js
nmspPluginAdminApi strkAlloyAdminApi
nmsp-plugin-admin-app strk-alloy-admin-app
nmsp-plugin-name.css strk-alloy.css
nmsp-plugin-name.js strk-alloy.js
nmspPluginApi strkAlloyApi
nmsp-plugin-front-app strk-alloy-front-app
nmspcli strkcli

Then I would rename the following:

Original New Name
/nmsp-plugin-name.php /strk-alloy.php
/includes/class-nmspcli.php /includes/class-strkcli.php
/resources/css/nmsp-plugin-name.css /resources/css/strk-alloy.css
/resources/js/nmsp-plugin-name.js /resources/js/strk-alloy.js

Setup

You'll need to run a few commands to set up the plugin for further development.

composer install
npm install && npm run compile

Available CLI commands

  • composer lint:wpcs : checks all PHP files against PHP Coding Standards.
  • composer lint:php : checks all PHP files for syntax errors.
  • composer make-pot : generates a .pot file in the languages/ directory.
  • npm run compile:css : compiles SASS files to css.
  • npm run compile:rtl : generates an RTL stylesheet.
  • npm run watch : watches all SASS files and recompiles them to css when they change.
  • npm run lint:scss : checks all SASS files against CSS Coding Standards.
  • npm run lint:js : checks all JavaScript files against JavaScript Coding Standards.
  • npm run bundle : generates a .zip archive for distribution, excluding development and system files.
Description
A boilerplate for a WordPress plugin
Readme 949 KiB
Languages
PHP 44.2%
CSS 26.1%
SCSS 25.8%
JavaScript 2.2%
Blade 1.7%