May 17, 2011

WordPress 3 Plugin Development Essentials Review

It's without a doubt that WordPress is one of the largest content management systems out there. WordPress has been known for its easy to use software and along with its extendability.

WordPress's extendability features, called plugins, have always been loved by WordPress's users as they provide an elegant system to expand WordPress to do practically anything.

In this post, however, we'll be speaking about how plugin development in WordPress 3 works. With Packt Publishing's latest WordPress book, WordPress 3 Plugin Development Essentials, it provides a nice and fairly detailed (281 pages) description on how WordPress 3 handles plugins.

My Experiences with WordPress

The first time I worked with WordPress was around five years ago when I started to become more evolved in web technologies. Now I should mention that I was not by any means an expert at WordPress at this time; I was, in fact, just a "normal" WordPress user back then.

Forward some years later when I was about to release Tech Cores v1.0, I already had the new pre-made theme I was going to use on top of Joomla, another content management system, but I turned my back on Joomla and switched to WordPress. The thing is, at this time, I had absolutely no experience working with WordPress theme development. What I did have, in fact, was knowledge of the PHP programming language, which WordPress relies on.

I picked up the "WordPress way" within days and started creating the first custom-made WordPress theme for Tech Cores; from the Photoshop design all the way to the final product... now, years later, I can literally code a normal website and convert it into a WordPress-compatible site in a heart beat.

All and all, I can call myself a WordPress "genius"; I've been working with it for years and I can never switch back for many reasons. Enough jibber-jabber, let's get on with the full review.

Thoughts on the Book

What I really love about WordPress 3 Plugin Development Essentials is that it starts off the first few chapters very simply. When just reading the first chapter, it explains on how setting up your WordPress development system, best coding practices (which can be used for no matter what you're programming), and how handle testing, code versioning, security, along with other things. For anyone reading this book, they most likely already have programming experience, and because the authors decided to start this book out in a way that's not too in a rush, it really means quite a bit. It's a great way to start off a book entirely on development...

The Beginning

Just like the first chapter, the second chapter doesn't rush you at all; in fact, it's more of giving you baby steps to start building powerful WordPress plugins. Any kind of developing book can be boring with all that computer code. But the best part I love about WordPress 3 Plugin Development Essentials is that you're not going to be seeing pages and pages of code; the authors give you some code, and describing what it's accomplishing. I've seen books that have two or three pages, back to back, that's filled with code only. No reader is going to give that code a good glance, it'll just confuse them. So with WordPress 3 Plugin Development Essentials, it takes a completely different approach; it takes the main functions of a plugin, the anatomy of a plugin, and breaks it down in an easy to comprehend way.

In the second chapter, there's one thing that rather surprised me in a WordPress plugin development book. In just the second chapter, the author has you making a plugin, that is, an "evil functionless plugin".  The author includes some errors in the plugin, where to put the header() function, whether or not to close the PHP tags (this was my favorite part of the chapter. Some WordPress users may edit a plugin, put some whitespace at the bottom, and find that everything is not working right. I'm glad this was added.), and a brief explanation to hooks.

With WordPress 3 Plugin Development Essentials brief introduction to hooks, the authors did one amazing job describing how they work in a simple manner. Hooks are extremely important in WordPress plugin development, if you didn't have it, your plugin wouldn't be as effective.

We're Making Plugins!

The next section of WordPress 3 Plugin Development Essentials is where everything starts coming together. The book guides you though implementing a Digg social media button next to each post. An easy concept, but ideal for learning how WordPress handles its plugins. The steps taken in this chapter to implement this feature is so nicely laid out, that you can practically use it as a guide when writing your own plugin. The authors don't rush into things, they make sure what you're going to implement will work, layout the general plan, create the main system, test it, add some more, and test it again. This approach was something that I really appreciated. As a programmer myself knowing many languages (really, don't get me started), I can truly say you want to take programming step by step.

The next two chapters are very similar to the previous one. You learn how to create a content rotator in the widget (typically a sidebar) section, which is very popular among WordPress blogs, and using the power of custom fields to expand the attached content to a post. With the content rotator, they could have integrated some neat jQuery content rotator, but I'm sure the reader can figure that out after reading the chapter. This is actually a very crucial chapter though, you learn how to integrate a widget with custom settings into WordPress! After that, you'r going right to the custom fields. Custom fields in WordPress is simply a way to put more content into your posts and do something with it. Personally, I use custom fields quite a bit on Tech Cores to get many of the things done that WordPress can't do out of the box.

What's fairly ironic is the how WordPress 3 Plugin Development Essentials described on how to implement custom fields is nearly identical to the way on how I accomplished it. Anyways, when getting back to the topic, I was very thrilled to read over this section. If there's one thing you should pick up from this book, it would have to be custom fields. With this small little feature, you can expand WordPress to do practically anything you want it to do. And yes, by the way, the way the authors described this is one of the best ways that I've ever heard. I have to give them an A+ on this entire chapter.

The next section is all about shortcodes. These are simply just like BBCode, but act as powerful extension to the text editor in WordPress. This was a fairly simple chapter, but using the function, registerpost type(), the authors were left with very little documentation about it; they ended up writing a chapter that I think, should be available on the WordPress Codex. I'm glad that WordPress 3 Plugin Development Essentials decided to make it so it was easy to understand in a practical use. Also, there's one thing that really let me down in this chapter. Like with many plugins, I see the plugins shortcode integrate with the TinyMCE text editor in WordPress to provide a GUI to shortcodes. I really think the authors should have added something like this as an example.

Additional Topics

WordPress 3 Plugin Development Essentials explains how to version your code using Subversion. Even though I prefer to use Cornerstone, the book explains how to do it the command line way, which will work on any operating system. This is a great chapter, it even discusses Google Code, but it seems a little out of place. I'm glad they added it, but I personally don't think they needed a full chapter on it.

The next chapter, is a very crucial part of WordPress plugin development: getting your plugin ready for the world! The authors review some common mistakes that make the plugins glitchy on other systems, like conflicting names. This entire chapter is all based upon testing, discussing WordPress limitations, and more. This chapter really tells you the things you need to make sure of when turning a development plugin into a released one.

You guessed it, the next chapter is releasing your plugin for real! This discusses some more best practices and things like localization, getting your plugin noticed, along with some minor things. Great chapter with lots of information!

The last good amount of pages include the appendix which just provides extra reference material (the WordPress Codex is amazing!). Just many of Packt's books, you can easily use this book as a reference guide when you need to. It only covers the essentials of WordPress plugin development, but enough for you to get practically anything done.

Overall, I really enjoyed WordPress 3 Plugin Development Essentials. It was a great short read and I learned a few extra tricks along the way. If you are a causal WordPress developer or you want to be, I highly recommend for you to pick up a copy. You may visit the book's website at the below link:

Stalk me on social media! Any other way would just be creepy…