#WordPress Plugin Boilerplate Powered
WordPress Plugin Boilerplate Powered is a complete foundation (without frameworks with many independent libaries ) for building your WordPress plugins.
Look in Recommended tools section of this readme for the Yeoman Generator and Vagrant.
You want to see which plugins have been made with this boilerplate or add them to the list? Check here!
Check the Wiki for other info.
##Features
###Library integrated
- Plugin Boilerplate Powered is based on Plugin Boilerplate by Tom McFarlin
- Checked the minimum version required with PHPCompatInfo (PHP 5.2)
- Sass support with Compass and Grunt
- CPT Core and Taxonomy Core integrated
- CMB2 + Shortcode Button
- Widget Boilerplate based on https://github.com/tommcfarlin/WordPress-Widget-Boilerplate
- WP Contextual Help integrated
- WP Admin Notice integrated
- PointerPlus integrated
- Function for custom template (like WooCommerce) in
includes/template.php
- Fake Page class in
includes/language.php
inincludes/fake-page.php
- Language function wrapper for WPML/Ceceppa Multilingua/Polylang in
includes/language.php
- Modified Debug system in
admin/includes/debug.php
- Very modified requirements detection on activation in
public/includes/requirements.php
- Modified CPT_Columns Class for CPTs columns in
admin/includes/CPT_Columns.php
###Snippet included
- Shortcode example code
- Dashicon as dependence of admin stylesheet
- Bubble notification on pending cpts
- Import/Export settings
- Custom capabilities with cpts and taxonomy support
- wp_localize_script for pass PHP var to JS in the frontend
- Class in frontend body with the slug of plugin
- Support for your CPTs in At glance widget in dashboard
- Support for CMBF in the options page
- Integrated DOM-Based Routing of Roots Template
###WordPress Plugin Boilerplate Feature
- The Plugin Boilerplate Powered is fully-based on the WordPress Plugin API.
- Uses PHPDoc conventions to document the code.
- Example values are given, so you can see what needs to be changed.
- Uses a strict file organization scheme to make sure the assets are easily maintainable.
- Note that this boilerplate includes a
.pot
as a starting translation file.
##Shell Script & Tools
###Included
- wp-boilerplate-version.sh (check below)
- phpcompatinfo.json for PHP Compat Info
- .php_cs for PHP-CS-Fixer
- apigen.sh script for generate a docs folder with the documentation
####wp-boilerplate-version
USE:
wp-boilerplate-version /path/my-new-plugin/ 1.1.1
Change the version in README.txt, plugin-slug.php and public/class-plugin-slug.php
Download the script, move in /usr/local/bin and set the permission
wget -O /usr/local/bin/wp-boilerplate-version https://raw.githubusercontent.com/Mte90/WordPress-Plugin-Boilerplate-Powered/master/wp-boilerplate-version.sh | chmod +x /usr/local/bin/wp-boilerplate-version
####phpcompatinfo
phpcompatinfo analyser:run . --php=">= 5.2"
Check if the plugin can work on PHP 5.2 (minimum requirement for WordPress).
There may be a false positive for JSON_PRETTY_PRINT
but in the code there is a version check for this.
###Suggestion
On https://github.com/sudar/wp-plugin-in-github there is many useful snippet for the deploy.
clone-from-svn-to-git.sh - Use this script to clone your WordPress Plugins from SVN into git/github
deploy-plugin.sh - Use this script to push your WordPress Plugin updates to SVN from git/github
readme-converter.sh - Use this script to convert readme files between Github markdown and WordPress repo markdown format
create-archive.sh - Use this script to create a zip archive of the Plugin
update-version.sh - Use this script to update version string in all the files of the Plugin
###Note
- Make Wordpress Core Handbook http://make.wordpress.org/core/handbook/
- Plugin Developer Handbook http://make.wordpress.org/docs/plugin-developer-handbook/
- Theme Developer Handbook https://make.wordpress.org/docs/theme-developer-handbook/
- JS library for uploads file with Media Picker: https://github.com/Apiki/wp-upload-file
- Useful snippet for wordpress development: https://github.com/richjenks/wp-utils
- WP Combine Queries - PHP 5.4+: https://github.com/birgire/wp-combine-queries
- WP_List_Table Example: http://www.sitepoint.com/using-wp_list_table-to-create-wordpress-admin-tables/
- WP Code Generator http://generatewp.com/
##Installation
PS: Use the Yeoman generator in the Generator Tool is better and simple!
- Copy the
plugin-name
directory into yourwp-content/plugins
directory - Navigate to the Plugins dashboard page
- Locate the menu item that reads TODO
- Click on Activate
This will activate the WordPress Plugin Boilerplate Powered.
Because the Boilerplate has no real functionality, nothing will be added to WordPress; however, this demonstrates exactly how your plugin should behave while you're working with the Boilerplate.
###Git Clone
git clone --recursive https://github.com/Mte90/WordPress-Plugin-Boilerplate-Powered
cd WordPress-Plugin-Boilerplate-Powered/plugin-name
##Git update submodule
git submodule update --recursive
git submodule foreach git pull origin master
##Recommended Tools
###Generator Tool
For WordPress Plugin Boilerplate Powered exist a Yeoman generator that allows you to choose the libraries you need with a small customization.
Link to repo: https://github.com/Mte90/generator-wp-plugin-boilerplate-powered/
###Vagrant
Exist also a VVV modded version (Vagrant configuration) called VVVWPBP that contain Compass, PHPCompatInfo, ApiGen and Yeoman for a fast development (the missing tool from the original VVV).
###Localization Tools
The WordPress Plugin Boilerplate uses a variable to store the text domain used when internationalizing strings throughout the Boilerplate. To take advantage of this method, there are tools that are recommended for providing correct, translatable files:
Any of the above tools should provide you with the proper tooling to localize the plugin.
##License
The WordPress Plugin Boilerplate Powered is licensed under the GPL v2 or later; however, if you opt to use third-party code that is not compatible with v2, then you may need to switch to using code that is GPL v3 compatible.