diff --git a/README.md b/README.md new file mode 100644 index 0000000..b9704a4 --- /dev/null +++ b/README.md @@ -0,0 +1,50 @@ +# WordPress Plugin Boilerplate + +The WordPress Plugin Boilerplate serves as a foundation off of which to build your WordPress widgets. + +## Features + +* The Plugin Boilerplate is fully-based on the WordPress [Plugin API](http://codex.wordpress.org/Plugin_API) +* Uses [PHPDoc](http://en.wikipedia.org/wiki/PHPDoc) conventions for easily following the code +* Liberal use of `TODO` to guide you through what you need to change +* Uses a strict file organization scheme to make sure the assets are easily maintainable + +## Usage + +The WordPress Plugin Boilerplate is ready to activate as-is (though it includes no real functionality). + +1. Copy the `plugin-boilerplate` directory into your `wp-content/plugins` directory +2. Navigate to the "Plugins" dashboard page +3. Locate the menu item that reads "TODO" +4. Click on "Activate" + +This will activate the WordPress Plugin Boilerplate. Because the Boilerplate has no real functionality, nothing will be added to WordPress; however, this demonstrates exactly how your plugin should behave as you're working with it. + +## License + +The WordPress Plugin Boilerplate is licensed under the GPL v2 or later. + +> This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License, version 2, as +published by the Free Software Foundation. + +> This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +> You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +## Changelog + +### 1.0 (29 November 2012) + +* Official Release + +## Author Information + +The WordPress Plugin Boilerplate was originally started and is maintained by [Tom McFarlin](http://twitter.com/tommcfarlin/). + +The project is open-source and receives contributions from awesome WordPress Developers throughout the world. diff --git a/README.txt b/plugin-boilerplate/README.txt similarity index 100% rename from README.txt rename to plugin-boilerplate/README.txt diff --git a/css/admin.css b/plugin-boilerplate/css/admin.css similarity index 85% rename from css/admin.css rename to plugin-boilerplate/css/admin.css index f8c50dd..a5854ad 100644 --- a/css/admin.css +++ b/plugin-boilerplate/css/admin.css @@ -1 +1 @@ -/* This stylesheet is used to style the admin option form of the widget. */ \ No newline at end of file +/* This stylesheet is used to style the admin option form of the plugin. */ \ No newline at end of file diff --git a/css/display.css b/plugin-boilerplate/css/display.css similarity index 100% rename from css/display.css rename to plugin-boilerplate/css/display.css diff --git a/js/admin.js b/plugin-boilerplate/js/admin.js similarity index 100% rename from js/admin.js rename to plugin-boilerplate/js/admin.js diff --git a/js/display.js b/plugin-boilerplate/js/display.js similarity index 100% rename from js/display.js rename to plugin-boilerplate/js/display.js diff --git a/lang/plugin.po b/plugin-boilerplate/lang/plugin.po similarity index 100% rename from lang/plugin.po rename to plugin-boilerplate/lang/plugin.po diff --git a/plugin.php b/plugin-boilerplate/plugin.php similarity index 76% rename from plugin.php rename to plugin-boilerplate/plugin.php index 9c1a840..b0311f1 100644 --- a/plugin.php +++ b/plugin-boilerplate/plugin.php @@ -38,8 +38,8 @@ class PluginName { */ function __construct() { - // load plugin text domain - add_action( 'init', array( $this, 'textdomain' ) ); + // Load plugin text domain + add_action( 'init', array( $this, 'plugin_textdomain' ) ); // Register admin styles and scripts add_action( 'admin_print_styles', array( $this, 'register_admin_styles' ) ); @@ -48,7 +48,8 @@ class PluginName { // Register site styles and scripts add_action( 'wp_enqueue_scripts', array( $this, 'register_plugin_styles' ) ); add_action( 'wp_enqueue_scripts', array( $this, 'register_plugin_scripts' ) ); - + + // Register hooks that are fired when the plugin is activated, deactivated, and uninstalled, respectively. register_activation_hook( __FILE__, array( $this, 'activate' ) ); register_deactivation_hook( __FILE__, array( $this, 'deactivate' ) ); register_uninstall_hook( __FILE__, array( $this, 'uninstall' ) ); @@ -72,44 +73,46 @@ class PluginName { /** * Fired when the plugin is activated. * - * @params $network_wide True if WPMU superadmin uses "Network Activate" action, false if WPMU is disabled or plugin is activated on an individual blog + * @param boolean $network_wide True if WPMU superadmin uses "Network Activate" action, false if WPMU is disabled or plugin is activated on an individual blog */ public function activate( $network_wide ) { - // TODO define activation functionality here + // TODO: Define activation functionality here } // end activate /** * Fired when the plugin is deactivated. * - * @params $network_wide True if WPMU superadmin uses "Network Activate" action, false if WPMU is disabled or plugin is activated on an individual blog + * @param boolean $network_wide True if WPMU superadmin uses "Network Activate" action, false if WPMU is disabled or plugin is activated on an individual blog */ public function deactivate( $network_wide ) { - // TODO define deactivation functionality here + // TODO: Define deactivation functionality here } // end deactivate /** * Fired when the plugin is uninstalled. * - * @params $network_wide True if WPMU superadmin uses "Network Activate" action, false if WPMU is disabled or plugin is activated on an individual blog + * @param boolean $network_wide True if WPMU superadmin uses "Network Activate" action, false if WPMU is disabled or plugin is activated on an individual blog */ public function uninstall( $network_wide ) { - // TODO define uninstall functionality here + // TODO: Define uninstall functionality here } // end uninstall /** * Loads the plugin text domain for translation */ - public function textdomain() { + public function plugin_textdomain() { + // TODO: replace "plugin-name-locale" with a unique value for your plugin load_plugin_textdomain( 'plugin-name-locale', false, dirname( plugin_basename( __FILE__ ) ) . '/lang' ); - } + + } // end plugin_textdomain /** * Registers and enqueues admin-specific styles. */ public function register_admin_styles() { - // TODO change 'plugin-name' to the name of your plugin + // TODO: Change 'plugin-name' to the name of your plugin wp_enqueue_style( 'plugin-name-admin-styles', plugins_url( 'plugin-name/css/admin.css' ) ); } // end register_admin_styles @@ -119,7 +122,7 @@ class PluginName { */ public function register_admin_scripts() { - // TODO change 'plugin-name' to the name of your plugin + // TODO: Change 'plugin-name' to the name of your plugin wp_enqueue_script( 'plugin-name-admin-script', plugins_url( 'plugin-name/js/admin.js' ) ); } // end register_admin_scripts @@ -129,7 +132,7 @@ class PluginName { */ public function register_plugin_styles() { - // TODO change 'plugin-name' to the name of your plugin + // TODO: Change 'plugin-name' to the name of your plugin wp_enqueue_style( 'plugin-name-plugin-styles', plugins_url( 'plugin-name/css/display.css' ) ); } // end register_plugin_styles @@ -139,7 +142,7 @@ class PluginName { */ public function register_plugin_scripts() { - // TODO change 'plugin-name' to the name of your plugin + // TODO: Change 'plugin-name' to the name of your plugin wp_enqueue_script( 'plugin-name-plugin-script', plugins_url( 'plugin-name/js/display.js' ) ); } // end register_plugin_scripts @@ -149,7 +152,7 @@ class PluginName { *---------------------------------------------*/ /** - * Note: Actions are points in the execution of a page or process + * NOTE: Actions are points in the execution of a page or process * lifecycle that WordPress fires. * * WordPress Actions: http://codex.wordpress.org/Plugin_API#Actions @@ -157,11 +160,11 @@ class PluginName { * */ function action_method_name() { - // TODO define your action method here + // TODO: Define your action method here } // end action_method_name /** - * Note: Filters are points of execution in which WordPress modifies data + * NOTE: Filters are points of execution in which WordPress modifies data * before saving it or sending it to the browser. * * WordPress Filters: http://codex.wordpress.org/Plugin_API#Filters @@ -169,10 +172,10 @@ class PluginName { * */ function filter_method_name() { - // TODO define your filter method here + // TODO: Define your filter method here } // end filter_method_name } // end class -// TODO: update the instantiation call of your plugin to the name given at the class definition +// TODO: Update the instantiation call of your plugin to the name given at the class definition $plugin_name = new PluginName(); \ No newline at end of file diff --git a/views/admin.php b/plugin-boilerplate/views/admin.php similarity index 84% rename from views/admin.php rename to plugin-boilerplate/views/admin.php index d5d53a2..3750202 100644 --- a/views/admin.php +++ b/plugin-boilerplate/views/admin.php @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/views/display.php b/plugin-boilerplate/views/display.php similarity index 100% rename from views/display.php rename to plugin-boilerplate/views/display.php