topleft
topright
Enter the Member Network Zone View the Top 10 Points Leaderboard View Members Who Are Currently Online View Latest Member Activity

Featured Members


Member Network Zone

Expert Blog Comments

How Do I Get Relevant Industry Experience?
Hi I would like to thank the builder of this website because it is helping so much people to find a ...
Project Managment Superheros: 6 Project-Saving Superpowers
Hinder the pace http://www.chanelbagsoutlet.com/ of our progress is often not the body extremely ht...
Employees Complain About Blocked Websites
I'm with Sean, basically. But there's probably not a one-size-fits-all solution here. Consultants ...
The Most Important Skill A Programmer Needs Isn’t Code Writing
It’s true, code generation made easy by development tools, programmers should have domain expertis...
5 Keys to Effective Status Reporting
great one. thanks for your work..
Review: WordPress Plug-In Development
Written by David F. Carr

WordPress Plugin Development: Beginner's Guide
By Vladimir Prelovac
Packt Publishing, February 2009

WordPress is primarily known as a blogging tool, but many of its fans argue that it is also a better content management system than many another content management system.


Blogging is such a powerful approach to keeping websites fresh and current that putting blogging capabilities at the center of a CMS is arguably a better approach than grafting a blog onto the side of a more general purpose CMS. WordPress can be used to add standing pages, not just blog entries, so it's easy enough to add the standard "About Us" and "Contact Us" material, or to have a branded home page people see before going to the blog. By extending the system, you can further to add your own custom application user interfaces and have them appear within the WordPress template.


One of the things that makes WordPress into a broader platform is the Application Programming Interface it offers for plug-in development, which is the topic of Vladimir Prelovac's book. The number of existing plug-ins for WordPress is impressive, but knowing how to construct your own frees is essential if you have unique requirements or want to integrate existing code and applications. The APIs are thoroughly documented on the WordPress website, but there is so much information there that it's hard to know where to start.


The book makes it all more comprehensible by walking you through six specific examples. It helps that the plug-ins you create in the process are actually useful ones. For example, the one he calls Insights is a blogger's utility for searching through past blog postings that the author might want to link to or otherwise reference. The same tool will let you add photos retrieved from Flickr. This demonstrates how to add functionality to the website administration screens. Another example plug-in, Fancy Archives, shows how to customize the display of archives pages with a script that checks for any images that may have been included with a post so that they can be displayed as part of the summary excerpt.


The WordPress API is based on a series of hooks -- filter hooks and action hooks -- that your plugin can register an interest in. A filter hook is used to process content retrieved from the database before it is displayed on screen, or, conversely, to process content posted by the user before it goes into the database. So this is where you can insert special formatting or data cleanup steps. WordPress hands the content to your function and expects you to return the modified version of it. An action hook is triggered by a system event like initialization or the posting of a new event. You could set an action hook to send a welcome email to each new user who registers and provides an email address.


One thing I hadn't seen in the open source documentation, prior to reading this book, is the Shortcode API, which allows you to put a simple placeholder on a page and have it replaced at runtime by some custom content. For example, [gallery] might be a placeholder for a photo gallery and [gallery id="123" size="medium"] might be a way of placeholder for a specific photo, where the attributes will be passed to the function responsible for retrieving and sizing the image. In the Fancy Archives example, Prelovac uses a shortcode placeholder on the page where the archives will appear.


I've also looked at the similar system of hooks and add-on modules in Drupal, another popular open source content management system, but the WordPress API strikes me as being just a little cleaner and simpler. My sense is that Drupal is probably more powerful but makes it harder to do the simple things. I know there is a fierce debate along those lines between fans of these two platforms, and I don't expect to settle it.


But this book convinced me WordPress can be extended to do just about anything I would want to do on the web. Once I had done the tour through Prevlovac's examples, I found it much easier to start looking through the code of other publicly-available plug-ins and figuring out how they work as well.


Very useful.




Comment on this article
RSS comments

Only registered users can write comments.
Please login or register.

[ Back ]




News & Noteworthy Archive

Past News Items From Reuters

White Paper Library

Copyright © 2007-2010 CIOZones. All Rights Reserved. CIOZone is a property of PSN, Inc.