Review: WordPress 3 Cookbook

What i like most in cookbooks, is their problem/solution approach which comes really handy when you find yourself facing a task with no clues on how to complete it.

WordPress 3 CookbookYep, there’s Internet, but having someone suggesting plugins and showing you the best solution feels less DIY development.

WordPress 3 Cookbook by Ric Shreves and Jean-Baptiste Jung is just like that.

Even if i think of myself as a experienced WordPress developer, i’ve found many hints on new plugins to check out and some good advices on website development. This sounds great in the messed up sea of WordPress resources.

But let’s dig into it.


The book is mainly meant for beginner to intermediate WordPress developers. It steps you through the most basic installation and customization tasks.

The same approach is taken to explore those areas beside core functionalities, involving the installation of one or more plugins to make it really simple, even from novice developers, to setup an advanced installation.

Marketing and SEO specialists may also be an interested audience, since last chapters of the book feature deep insights on SEO optimization and advertising (both with AdSense and custom ads systems).


During the last years WordPress development has become a huge subject, spanning from simple page-based websites to shopping, community and multisite. That said, the book covers most of the scenarios where WordPress get used, maybe even too many for the intended audience.

For example, I’ve really enjoyed the chapter about BuddyPress and social community building, but I think the plugin is so much more complex than how depicted by the author, and anyway it alters so much the theme and system behavior that novice users may get lost.

What i’ve found really interesting, instead, are those chapters about website marketing and SEO, covering features commonly requested by clients but still not provided by the WordPress’s core.

The author covers sitemaps, XML sitemaps and search engine related topics by providing excellent plugins and detailed howtos to 3rd party services (like AdSense).

Beside this, you’ll find detailed chapters on themes and widgets management which are main topics even if you prefer to buy themes from external providers instead of coding your owns.

There’s then an introduction to the WordPress’s loop system with basic informations on how to customize templates and lists of contents. It’s well done, but could have been more in-depth.

Last words

Again, I’m disappointed by the choice of the author to suggest plugins even for those little customizations which involve little coding, when the eccessive number of plugins is a known performance problem in WordPress.

Maybe reducing the number of topic, or reducing those chapters devoted to core functionalities (already covered by the official documentation) would have offered space to describe coded alternatives to plugins, in order to give a better development guideline to novice developers.

Despite this, WordPress 3 Cookbook is an interesting reading and a well crafted cookbook which may find a prime spot on many developer’s desk.



On the Bookshelf: WordPress 3 Cookbook

Despite the large amount of tutorials and quick tips available over the Internet, I find cookbooks a most valuable resource to recap, collect and organize those most helpful tricks of a programming language / CMS / library.

WordPress 3 Cookbook That’s why during this winter break I’m going to read the latest released cookbook about WordPress by Packtpub titled “WordPress 3 Cookbook“.

As from other reviews and the table of contents, the book’s 9 chapters cover every aspect of WordPress 3 development, from basic installation and theme customization to plugins and widgets development.

I’ve also took a sneak peek at chapter 5 on “Building Interactivity and Community” which covers many fancy and now-so-cool topics as facebook/twitter integration. It also covers basic customization and development with BuddyPress community plugin which i s a product I’ve lately used on one of my projects.

Since the book’s structure is of a classic tech cookbook (“I have a question, here is the answer”), WordPress 3 Cookbook seems a good reading for both novice and expert developers as it stands as an excellent collection of the most important topics about WordPress development.

I’ll keep you posted for a more in-dept review of the book.



Review: WordPress 2.9 e-Commerce Guide

As a user, i love the e-commerce era, since it offers good deals and virtually every product i’d need.

As a developer, though, i’ve always hated projects involving the setup of an e-commerce store mainly because of the complexity of available web applications. This is especially true when it comes to customize themes, logics and behaviors of the store.

In my experience i’ve worked on Virtuemart, OsCommerce and ZenCart finding them too complex and large for my client’s needs.

On this matter i’ve found really enlightening the WordPress 2.9 e-Commerce guide by Brian Bondani, which presents the WP e-Commerce plugin for WordPress which is both a great solution for small e-stores owners and an affordable solution for expert and novice developers.

The guide isn’t intended just for developers, but also for persons with basic computer skills willing to setup their online store. Technical knowledge of WordPress, CSS and PHP will allow you to further customize the installation, theme and store’s styles even if a basic section of the guide explains the basics of customization for novice developers too.


WordPress 2.9 e-CommerceThe most prominent aspect of the guide is that it covers not just the configuration and customization of the plugin, but even the installation and configuration of WordPress with a detailed step by step tutorial on compatible themes and options to convert the blog engine into a dedicated e-store system.

On the plugin side, you’ll be impressed of the different options and configurations available to customize and refine your store. Reading the guide you’ll be able to easily setup both digital and physical items, with flexible shipping rates and discounts.

Starting from a vanilla installation the author guides you on a detailed step by step tutorial on the various configuration’s options, like international shipping rates and product variations (different sizes, colors) using a clear language and many screenshots of the actual plugin interface.
This ends up in a no-surprises situation when you’ll be hands-on the plugin.

For more advanced users there’s also a chapter which covers the customization of themes, with technical but clear examples of CSS and PHP code.

What’s extremely useful about the guide is that many chapters move beyond technical explanations of WordPress and WP e-Commerce plugin, focusing on how to market your store to increase your income.

By covering tools as Google AdSense, the guide serves also as a basic web-marketing reference introducing the most relevant aspects of e-commerce’s promotion which is often an overlooked aspect both by clients and developers.

Whether you are building your own store or you are a developer with non-professional skill on web marketing you’d find these chapters really useful even for other kind of projects.

Another good section of the book covers the most important online payment gateways like PayPal and Google Checkout guiding the developer throughout each step needed to correctly setup and manage these novice-unfriendly systems.

Even if many of these systems are well integrated in the WP e-Commerce plugin, requiring little effort for activation, i’ve found it a good choice to explain their functionality and every step to manage customers’ payments since that’s the most painful task for every online store owner.

The last chapters of the book are devoted to an insight of the plugin’s commercial addon and to alternative plugins. These are usually less powerful systems than WP e-Commerce but may be useful if you just need to sell some simple items.

Last Words

Before reading this guide i would have never thought to WordPress as an e-Commerce CMS, but the in depth explanation of WP e-Commerce by Brian Bondani showed me how simple and powerful is this platform for every-day stores compared to big and mind-expensive systems like ZenCart.

This makes the overall feeling about this guide as of the discover of a new world, making it a good reading not just for WordPress developers, but also for others looking for good and affordable ways to build and promote their online stores without having to deal with unneeded complexity.

You may tak check out the guide page at Packt Publishing, as well as the Table of Contents. Then you may also take a closer look at contents by reading the sample chapter.



Taming Flash Of Unstyled Content without blocking JavaScript loading

One of the best rule in development is that the less you (as developper) struggle, the more the user will… and viceversa.

Lately i’ve tested some techniques to overcome the blocking nature of script tags to improve page load performance, and i ended up using LABjs which seems a really promising project.
The main drawback of this non blocking technique is that, since JavaScript parsing is not blocking the interface anymore users may encounter several flash of unstyled (or un-behaviored) content (FOUC – FUBC), which may break the interface (and make your marketing team screams at you).

The solution here is: struggle a bit more instead of leaving script tags in the head.

What i’ve came up by following some suggestions by the LABjs author and the web community is to separate my CSS styles in two separate levels: one for un-behaviored contents and one for JavaScript enabled browsers.
The trick is simple: since the only tag script you need is the one of LABjs, just open it and add this line at the very top of the file:

document.documentElement.className = 'hasJS';

This way you will add a hasJS class to the html tag that you may target in the CSS rules to overwrite and implement styles to get your interface ready for JavaScript interactions.

The drawback of this technique is that adding a class attibute to html tag won’t validate, but that’s the only CSS addressable node before DOM ready event.

This way your interface won’t flash anymore and your users won’t notice any change while JavaScript is getting loaded in a more efficient way.



On the Bookshelf: WordPress 2.9 e-Commerce

I know: someone may be horrified by the idea of using WordPress as an e-commerce system, but i think that given its user friendly backend interface and the amount of developers using it, it’d be a mistake not to learn something about the WP “e-commerce way”.

WordPress 2.9 e-CommerceThe guide i’m introducing here, and which i’m currently reading, is WordPress 2.9 e-Commerce and explores the WordPress plugin WP e-Commerce which is for sure a good choice for a small shopping website.

The book is intended for WordPress developers, but i think it’d be a good reading for every developer which is sick of too complex and messed up solutions as Magento and Virtuemart.

If you’d like to know something more on the book, just stay tuned!



Review: MooTools 1.2 Beginner’s Guide

One major problem with JavaScript programming is that, differently from other languages, there are little programmers with really good knowledge of it.
This problem is tightly related to the lack of a solid culture in front-end development, which usually is a gray area between programmers and designers.

Even if a solid knowledge of JavaScript should be a must, a good way to avoid bad practices and headaches is by using a JavaScript library, which will make coding easier and much more beginner friendly.

MooTools is such a library, and offers a lot of methods and patterns for better JavaScript coding.

Introducing MooTools 1.2 Beginner’s Guide

Even if I’m not a MooTools novice, i had the chance to read MooTools 1.2 Beginners Guide by Jacob Gube and Garrick Cheung (Packt Publishing), which turned out to be also an interesting reading to better understand all of the improvements made by MooTools from the 1.11 version.

From this perspective the book, which aims primarily to beginner MooTools developers, may also be a good reference for users of previous versions willing to update their scripts.

That said, the book doesn’t cover all of the methods offered by the library, but is intended by the authors as a step by step introduction to MooTools development and gives a solid knowledge of its undergoing philosophy.

The approach is strongly examples-oriented to better and clearly show how the library works and to give some starting point for developers willing to practice hands-on.

The Good Parts

The guide’s table of contents spans from the core $ function to the plugin’s usage and factoring, introducing the most relevant and commonly used part of the library. Writing is fluent and familiar keeping it easy while accurate.

First of all, I really appreciated the well done part about utility functions which are, in my opinion, one of the library’s key features since they make possible to save lot of repetitive coding: functions like $type, $each or the Browser object grant a cross-browser and risk free development with little effort.

The other aspect which is deeply covered is the Class construction pattern.
By using this pattern every novice developer is able to code JavaScript classes with syntax similar to other programming languages like PHP, thus filling the lack of real classes in JavaScript and avoiding global object pollution.

Also well documented is the animation chapter about FX classes, which still are the best choice for performance and browser rendering (FX has been the first part of the original library).

A full chapter at the end of the book is dedicated to plug-in development, featuring not only an explanation on how write a plug-in, but also teaching how to design a plug-in starting from existing scripts and reusability requirements.
This part has been an unexpected surprise, since few guides intended for technical audience teach code’s design process with design sheets and documentation guidelines.

Beyond Examples

As of its introduction, the guide is intended as a step by step process in learning the bases in MooTools development; anyway little effort is spent in explaining why using MooTools is not just a smarter way of coding, but also and above all a better approach to JavaScript.

Learning common scripting mistakes is the way to understand that using a library is not just cool and that libraries aren’t vital, but still an affordable toolkit for JS scripting.

Talking about library presentation, it’d be a good idea to explain more in details some DOM manipulation methods, since many developers are used to circumvent (often too roughly) document and CSS limits by cutting and remixing elements with JavaScript.
MooTools has a big list of such methods which often are a better choice than native JS both for performance and browsers’ support.


As a whole, MooTools 1.2 Beginners Guide gives a clear and solid basic knowledge of how the library works, making it possible for a novice developer to dive into the official documentation without feeling lost.

Even if some background thoughts about its development patterns would be appreciated, I’d definitely suggest the book to MooTools beginners (but not to JavaScript beginners for the mentioned reason).
Moreover it’s a quick reference for commonly used methods and classes, therefore a book to keep on your desk.

You may check the publisher website to get the complete table of contents and read a sample chapter or just jump to the book main page here.



Fix role attribute in WordPress Search Widget

While validating a WordPress theme, I’ve  noticed that the default search widget outputted a role HTML attribute in the form tag that wasn’t valid in the XHTML 1.0 specification:

<form role="search" method="get" id="searchform" action="">

As for the spec, role is an attribute introduced in XHTML draft for accessibility, but still not valid.

If you need valid documents, the fastest way to get rid of this attribute is to edit the get_search_form() function in general-template.php core file, but for better compatibility and safer future upgrades you can target the issue from your theme’s functions.php file by adding the following lines:

function valid_search_form ($form) {
    return str_replace('role="search" ', '', $form);
add_filter('get_search_form', 'valid_search_form');




On the Bookshelf: MooTools 1.2 Beginner’s Guide

In nowadays frontend development JavaScript spans from rich interactions to animations, however we cannot rely on the native language’s methods to implement everything we need in a smart and time-effective way.

The best solution for our coding needs is to adopt a JS framework as backbone for our scripts. One of the very first framework I’ve worked with is Mootools, since it’s very developer friendly and fulfils lots of JavaScript’s “holes”.

In the next few days i’m going to receive a copy of:  MooTools 1.2 Beginner’s Guide, which I’m going to review for the sake of some of my followers and friends which are in need of a good starting point to learn how to improve their interfaces.

If you are interested you can check the details of the guide at the publisher website.

Stay tuned!



UI Fundamentals for Programmers [video]

In a slice of spare time i’ve watched this really interesting video presentation by Ryan Singer from 37signals taken at WindyCityRails 2009 in Chicago.

The presentation is mainly focused on User Interface best practices to keep interaction clear and direct, and on patterns to think and design interfaces from a user/ customer perspective.

Enjoy it:

Many thank to Postion Absolute for sharing the link.



Using multiple templates’ overrides in Joomla 1.5 modules

One of most usefull feature in Joomla 1.5 is the ability to quickly customize the HTML output of a module by using template overrides (see here for details).

The only problem is that, once you have coded an override for a module, it’ll be used for all module’s instances within the CMS. The issue here is that you might want to output one module in a column as just a simple list of links AND in the main body as a content-rich table.

This problem can be addressed with a module hack and the addition of a new backend parameter type (for 1.5 native modules only), both in a system wide or module specific way . Here is a step by step tutorial:

Adding a new parameter to the module

Joomla 1.5 features a native way to add backend parameter types beside the native ones. In our case i’ve realized a new element (parameter) file which will look if a template override folder exists for the spefic module and, if found, will list all PHP files whose name is prefixed with “custom_” . You can download the file here.

Now you’ll need to place this file inside a folder called element, then open the .xml configuration file of the module and search for the <params> opening tag. Replace it with the following code (YOURMODULENAME is the module name):

<params addpath="/modules/mod_YOURMODULENAME/element">

Now place the new parameter as the last child of the <params> tag:

<param name="template" type="customtemplates" modulename="mod_YOURMODULENAME" default="default" label="Custom template" description="Use this custom template file" />

Hacking the main PHP module file

To make the module fully aware of the new template you choose, you need to pass the customtemplates paramenter to the static method which retrieves the template. For instance let’s say your mod_mymodule.php file has a line like this:

require( JModuleHelper::getLayoutPath( 'mod_mymodule') );

Now provide the customtemplates parameter by changing the line to:

require( JModuleHelper::getLayoutPath( 'mod_mymodule', $params->get('template','default') ) );


Untill no custom template’s overrides are found, the default template (default for the module or the default override if present) will be used. Once you’ll create a custom_whatever.php template file it’ll show up in the select list.

Adding the new parameter system-wide

By adding the parameter as a native-like parameter, you’ll be able to use it on all module without calling it in the <params> tag.

To add the paramenter system-wide you just have to place the customtemplates.php element in the /libraries/joomla/html/parameter/element folder. Since this is a custom element you shouldn’t have any problem on CMS upgrades.

The drawback

There’s a major drawback for this solution: since you are going to modify some module’s file you’ll need to keep a copy of them to prevent future upgrades from removing your changes (and breaking your template).

Further readings

Joomla has a really flexible parameter system, underused by many developers. Here are a couple of further reading to understand how parameters can help your everyday Joomla coding: