Body Classes for Styling WordPress Taxonomies

I recently noticed that WordPress does not seem to add style classes to the body tag for custom taxonomies in the same way that it does on category archives.

You can fix this by adding the following to your functions.php file.

function taxonomy_body_class( $classes ) {
	if ( is_tax() ) {
		$tax = get_query_var( 'taxonomy' );
		$term = $tax . '-' . get_query_var( 'term' );
		$classes = array_merge( $classes, array( 'taxonomy-archive', $tax, $term ) );
	return $classes;
add_filter( 'body_class', 'taxonomy_body_class' );

I don’t know why WordPress doesn’t do this automatically – I guess it should be added to core. What do you think?


New style hooks for WordPress Theme Developers in WP e-Commerce 3.7.5

The latest version of Instinct’s WordPress e-commerce plugin uses the WordPress body_class filter to add classes to the HTML body tag.

WP e-Commerce 3.7.5 adds the following styles to the body tag:

  • wpsc
  • wpsc-home
  • wpsc-single-product
  • wpsc-single-product-id
  • wpsc-category
  • wpsc-category-id
  • wpsc-group-id
  • wpsc-shopping-cart
  • wpsc-transaction-details
  • wpsc-user-account

These extra classes will give you more flexibility when designing themes for WP e-Commerce.



Stylish Categories for WP e-Commerce

I’ve made my first contribution to the WP e-Commerce plugin – my first contribution to an open source project…

It’s a great e-commerce plugin for WordPress but there were a few visual things niggling me that I thought should be sorted out – mainly the way that the widget for showing categories was not styled the same way as the WordPress default widgets.

Fixing the issue was just a case of making a couple of tweaks to the HTML; changing some square brackets to normal brackets and removing some bold styling.

Nothing revolutionary there, but it should now look a whole lot better with your default WordPress theme without making any modifications…

The current version in development WP e-Commerce 3.7 is looking great, with an overhaul of the user interface to bring it into line with WordPress 2.7, a complete reorganisation of the code making it easier for us developers, and a new template engine which works along the same lines at the WordPress Loop so that theme authors can now get in on the act without having to delve too far into the plugin’s code.


Yellow Form Fields?

Why do you sometimes see yellow forms fields on web sites?
What are they and why are they there?

The answer is Google Toolbar. If you have Google Toolbar installed and the AutoFill option enabled, Google will remember your personal information so that it can automatically populate form fields for you. Fields such as name, address and phone will all turn yellow if AutoFill is turned on – the default setting.

Although it is good useability for these fields to be highlighted in some way, as a web designer you may not want yellow form fields on your web page for aesthetic reasons.

So, how do you override it…?



CSS Bugs: Fix for IE / Win gap between list items

Recently I stumbled across the annoying IE/Win bug of gaps between vertically stacked list items.

After searching around for a while I found a fair few fixes. However, none of these seemed to work for me. The only different I could find was that my list contained images where the other examples were purely text.

I fixed the bug by chance whilst implementing a fix by John Serris at

It turned out that when using the “vertical-align: bottom” fix applied to the list item tag, I also needed to apply it to the ‘a’ and ‘img’ tags as well:

#navsec a, #navsec img { vertical-align:bottom; }