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?

 

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 www.phonophunk.com.

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; }

…