Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Micro boilerplate #547

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 5 additions & 55 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,15 @@
# WordPress Plugin Boilerplate
# WordPress Micro Plugin Boilerplate

A standardized, organized, object-oriented foundation for building high-quality WordPress Plugins.
A standardized, organized, object-oriented, mimimal foundation for building high-quality Services or tiny WordPress plugins.

## Contents

The WordPress Plugin Boilerplate includes the following files:
The WordPress Micro Plugin Boilerplate includes the following files:

* `.gitignore`. Used to exclude certain files from the repository.
* `CHANGELOG.md`. The list of changes to the core project.
* `README.md`. The file that you’re currently reading.
* A `plugin-name` directory that contains the source code - a fully executable WordPress plugin.

## Features

* The Boilerplate is based on the [Plugin API](http://codex.wordpress.org/Plugin_API), [Coding Standards](http://codex.wordpress.org/WordPress_Coding_Standards), and [Documentation Standards](https://make.wordpress.org/core/handbook/best-practices/inline-documentation-standards/php/).
* All classes, functions, and variables are documented so that you know what you need to change.
* The Boilerplate uses a strict file organization scheme that corresponds both to the WordPress Plugin Repository structure, and that makes it easy to organize the files that compose the plugin.
* The project includes a `.pot` file as a starting point for internationalization.

## Installation

The Boilerplate can be installed directly into your plugins folder "as-is". You will want to rename it and the classes inside of it to fit your needs. For example, if your plugin is named 'example-me' then:
Expand All @@ -30,22 +22,6 @@ The Boilerplate can be installed directly into your plugins folder "as-is". You

It's safe to activate the plugin at this point. Because the Boilerplate has no real functionality there will be no menu items, meta boxes, or custom post types added until you write the code.

## WordPress.org Preparation

The original launch of this version of the boilerplate included the folder structure needed for using your plugin on WordPress.org. That folder structure has been moved to its own repo here: https://github.com/DevinVinson/Plugin-Directory-Boilerplate

## Recommended Tools

### i18n 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:

* [Poedit](http://www.poedit.net/)
* [makepot](http://i18n.svn.wordpress.org/tools/trunk/)
* [i18n](https://github.com/grappler/i18n)

Any of the above tools should provide you with the proper tooling to internationalize the plugin.

## License

The WordPress Plugin Boilerplate is licensed under the GPL v2 or later.
Expand All @@ -68,32 +44,6 @@ For reference, [here's a discussion](http://make.wordpress.org/themes/2013/03/04

### Includes

Note that if you include your own classes, or third-party libraries, there are three locations in which said files may go:

* `plugin-name/includes` is where functionality shared between the admin area and the public-facing parts of the site reside
* `plugin-name/admin` is for all admin-specific functionality
* `plugin-name/public` is for all public-facing functionality

Note that previous versions of the Boilerplate did not include `Plugin_Name_Loader` but this class is used to register all filters and actions with WordPress.

The example code provided shows how to register your hooks with the Loader class.

### What About Other Features?

The previous version of the WordPress Plugin Boilerplate included support for a number of different projects such as the [GitHub Updater](https://github.com/afragen/github-updater).

These tools are not part of the core of this Boilerplate, as I see them as being additions, forks, or other contributions to the Boilerplate.

The same is true of using tools like Grunt, Composer, etc. These are all fantastic tools, but not everyone uses them. In order to keep the core Boilerplate as light as possible, these features have been removed and will be introduced in other editions, and will be listed and maintained on the project homepage.

# Credits

The WordPress Plugin Boilerplate was started in 2011 by [Tom McFarlin](http://twitter.com/tommcfarlin/) and has since included a number of great contributions. In March of 2015 the project was handed over by Tom to Devin Vinson.

The current version of the Boilerplate was developed in conjunction with [Josh Eaton](https://twitter.com/jjeaton), [Ulrich Pogson](https://twitter.com/grapplerulrich), and [Brad Vincent](https://twitter.com/themergency).

The homepage is based on a design as provided by [HTML5Up](http://html5up.net), the Boilerplate logo was designed by Rob McCaskill of [BungaWeb](http://bungaweb.com), and the site `favicon` was created by [Mickey Kay](https://twitter.com/McGuive7).

## Documentation, FAQs, and More
Note that if you include your own classes, or third-party libraries, there is a location in which said files may go:

If you’re interested in writing any documentation or creating tutorials please [let me know](http://devinvinson.com/contact/) .
* `plugin-name/includes`
103 changes: 0 additions & 103 deletions plugin-name/admin/class-plugin-name-admin.php

This file was deleted.

4 changes: 0 additions & 4 deletions plugin-name/admin/css/plugin-name-admin.css

This file was deleted.

1 change: 0 additions & 1 deletion plugin-name/admin/index.php

This file was deleted.

32 changes: 0 additions & 32 deletions plugin-name/admin/js/plugin-name-admin.js

This file was deleted.

16 changes: 0 additions & 16 deletions plugin-name/admin/partials/plugin-name-admin-display.php

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,26 +1,24 @@
<?php

/**
* The public-facing functionality of the plugin.
* The functionality of the plugin.
*
* @link http://example.com
* @since 1.0.0
*
* @package Plugin_Name
* @subpackage Plugin_Name/public
*/

/**
* The public-facing functionality of the plugin.
* The functionality of the plugin.
*
* Defines the plugin name, version, and two examples hooks for how to
* enqueue the public-facing stylesheet and JavaScript.
* enqueue the stylesheet and JavaScript.
*
* @package Plugin_Name
* @subpackage Plugin_Name/public
* @author Your Name <[email protected]>
*/
class Plugin_Name_Public {
class Plugin_Name {

/**
* The ID of this plugin.
Expand Down Expand Up @@ -55,7 +53,7 @@ public function __construct( $plugin_name, $version ) {
}

/**
* Register the stylesheets for the public-facing side of the site.
* Register the stylesheets for the site.
*
* @since 1.0.0
*/
Expand All @@ -64,16 +62,12 @@ public function enqueue_styles() {
/**
* This function is provided for demonstration purposes only.
*
* An instance of this class should be passed to the run() function
* defined in Plugin_Name_Loader as all of the hooks are defined
* in that particular class.
*
* The Plugin_Name_Loader will then create the relationship
* The Plugin_Name_Init will then create the relationship
* between the defined hooks and the functions defined in this
* class.
*/

wp_enqueue_style( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'css/plugin-name-public.css', array(), $this->version, 'all' );
wp_enqueue_style( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'css/plugin-name.css', array(), $this->version, 'all' );

}

Expand All @@ -88,15 +82,15 @@ public function enqueue_scripts() {
* This function is provided for demonstration purposes only.
*
* An instance of this class should be passed to the run() function
* defined in Plugin_Name_Loader as all of the hooks are defined
* defined in Plugin_Name_Init as all of the hooks are defined
* in that particular class.
*
* The Plugin_Name_Loader will then create the relationship
* between the defined hooks and the functions defined in this
* class.
*/

wp_enqueue_script( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'js/plugin-name-public.js', array( 'jquery' ), $this->version, false );
wp_enqueue_script( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'js/plugin-name.js', array( 'jquery' ), $this->version, false );

}

Expand Down
4 changes: 4 additions & 0 deletions plugin-name/css/plugin-name.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/**
* All of the CSS for your facing functionality should be
* included in this file.
*/
36 changes: 0 additions & 36 deletions plugin-name/includes/class-plugin-name-activator.php

This file was deleted.

Loading