Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
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:
Prefixing things is a thing of the past now that we can use Namespacing going forward. wpkickstart offers easy Namespacing.
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.
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
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.