Skip to content
This repository has been archived by the owner on Nov 2, 2020. It is now read-only.
Aubrey Portwood edited this page Feb 4, 2019 · 13 revisions

Installation & Use →


Why

wpkickstart was created out of my own personal problems using https://github.com/WebDevStudios/generator-plugin-wp.

Things I didn't like about it, and what I did in wpkickstart to do a better job:

Lacked Namespacing

Prefixing things is a thing of the past now that we can use Namespacing going forward. wpkickstart offers easy Namespacing.

Javascript, CSS, & Mobility Lacking

Since it put all the CSS and Javascript in an assets/ folder (not to mention also built it into minified files for you) away from your classes, when I wanted to reuse code I often had to connect a lot of dots to find code that went with the class(es) like Javascript, CSS, dependencies, etc which was time consuming.

wpkickstart groups like-code into folders. When you make a new class(es) that do a thing as either a service or a component you should put all the Javascript, CSS, and dependencies in that folder with it.

This way when you want to reuse a component or a service (components are more likely) all you have to do is move it's folder around and all the things come with it. The plugin generator lacked this ability.

How things talked to each other was bad

wpkickstart features a cool app() function that lets you talk to other parts of your plugin. The way the plugin generator did that was through passing a $plugin variable around and it was hard to keep track of. $app (our variable) can be called anytime using a helpful app() function that is namespaced as well.

Did too much (wpkickstart is not a generator)

I often found myself (and others) rarely using the generators. Maybe to get a fraction of the code it generated, but often (on client projects) code is still written differently project to project. I also rely on snippets for this anyways as they are tailored more for use than the generator.

I wanted to actually build my code and found when I did that I ended up with higher quality code than the generator gave me. It made lots of assumptions that, if you didn't catch it, could end you up with e.g. a security hole, like leaving a CPT public, etc.

wpkickstart simply gives you a good place to start building a plugin with tools and code that you don't have to write to start a plugin. But it doesn't do anything else. You get to write the code to build something, but you don't have to build the framework. wpkickstart isn't a generator all it does it offer up an easy framework to work in so you don't have to do basic plugin stuff over and over.

If you want generated code, go reuse a component if you need to, that's as close to a generator as we're ever going to get.

Guiding Principles

Communication with other objects in your plugin should be easy

If one object wants to talk to another object, you shouldn't have to pass objects around. wpkickstart does this easily with app().

We should never generate code for you, you want to write unique code, go have fun!

We are not a generator. Read the above why.

Help them stay organized, but let them do what they want!

Though I built this with a style for organization in mind, just so that is another decision you don't have to make, the organization is simple: You have services and components, that's it! Beyond that you organize your code the way you want!

Always adhere to WP Coding Standards

Some things you might see in wpkickstart are classnames use underscores e.g. My_Class_Name and, likewise, package names and namespacing follows suite. This is because WP Coding standards require this style vs MyClassName. We will always adhere to WordPress coding standards.

Be modern, but support the novice

I had attempted to re-work wpkickstart to be organized using modern OOP structures. But, I found that early 2013 me (the novice) probably could not have used it if it were. The one thing I did like about the plugin generator was that it had a low barrier to entry and so wpkickstart is organized in a way that has a low barrier to entry (liberal), but also keeps in mind more modern OOP structures (modern). wpkickstart actually leans a bit more on the liberal side as anyone who wants to code in this framework, should be able to easily.