Adding a sub-menu indicator to parent menu items

It’s very handy from a UI perspective to indicate which menu items have a sub-menu beneath them (often a small triangle or arrow is used). When using wp_nav_menu(), WordPress adds the “sub-menu” class to the <ul> tag of any sub-menus, but nothing to the parent list item; this makes them difficult to target.
Continue reading Adding a sub-menu indicator to parent menu items

Montreal Dev Meetup: Demystifying The Theme Review Process

I’ll be giving a talk this Thursday, February 2nd, at the Montreal WordPress Dev Meetup (find out details on the Facebook page).

I’ll be discussing the WordPress Free Themes Directory, the Theme Review Team (for which I volunteer), and shed some light on the theme review process. We’ll also dig in to some code to show you some common errors, best practices, and ultimately, how to get your theme approved with minimal frustration and maximum learning.

These dev meetups are always a lot of fun, and will have plenty for both fresh newbies and the experienced coder alike. See you there!

Slides from the presentation are available here, and there are also some photos by TP1.

Using XML to define translatable strings in WPML

WPML, a plugin for handling multilingual content in WordPress, has the ability to read an XML file  for its configuration. In this language configuration file, we can define which custom fields, custom post types, taxonomies and admin texts we want translatable in our theme.
Continue reading Using XML to define translatable strings in WPML

Getting the most out of WordPress premium themes

A WordPress premium theme (loosely defined as a theme that must be purchased) can give a quantum leap to your website with very little cash down (themes are usually in the $25-$40 USD range). While most premium themes are beautifully designed and excellent value for money, make sure to do some homework first – they are most definitely not created equal.
Continue reading Getting the most out of WordPress premium themes

WooThemes and doing it right

I’ve been a fan of WooThemes since discovering them four or five months ago – they’re one of the most popular premium WordPress theme suppliers, with over 40000 paid customers. Oddly enough, I find their flagship product (Canvas, a “theme framework”) kind of frustrating (more on that later), but so far I’ve stuck with them; here’s why.
Continue reading WooThemes and doing it right

Error establishing a database connection

WordPress generates its pages on-the-fly, pulling information from a database. If you request a web page and the server is having a hard time talking to the database, it will sometimes display “Error establishing a database connection”.

I’ve seen this most often on less-expensive hosting accounts; almost every time it was a GoDaddy account (one reason why I rarely recommend them).

What can you do about it? Just refresh the page; often it’s only a temporary spike that goes away. If the issue remains, you may have a genuine problem and should speak to your WordPress professional.

If you’re on GoDaddy? Call their support at (480) 505-8877 and make sure your current plan is the best thing for you. You can also consider upgrading/cross-grading to one of their WordPress-specific hosting plans, often at no additional cost.

Cleaning up URLs

Why do some of my page links have extra numbers, like “”

The “-2” is caused by creating pages or posts with the same title. WordPress needs a unique name (called the “slug”) for every post, which it creates, by default, from the post’s title. If another post is created with the same title, WordPress will add an increasing number to the end of its slug to keep the posts distinct from each other in the database.

For example, working on your About page, you decide to make another version. When you title the second post “About”, the same as the first post, WordPress will quietly give it the slug of “about-2” (seen in the post editor as “Permalink”, just below the title).

Of course, you can use the Edit button to change the slug to whatever you want, including simply “about” (slugs are always lowercase and alphanumeric, with only underscores or hyphens as special characters).

It won’t let me change it to just “about”.

You have to get rid of the other post named “about” to let the newer post have that slug.

But I’ve already trashed the first version, and it still won’t let me change it.

You have to empty the trash to truly free up that slug. A post in the trash is still in the database (which is how we can restore it at another time if we so choose). Emptying the trash permanently removes that post from the database, and frees up the desired slug.

Clean URLS are an important part of effective SEO (search engine optimization) and make your links as simple and memorable as possible for your users. Clean ’em up!