Quick Tip! What happens when your post title does not fit on one line? It wraps to the second line. What if it’s only one word? And what if that word is “it” or some other shorty? Your title won’t look too nice, eh? Here’s a solution, somewhere inside the loop:
$title = the_title( '<h2>', '</h2>', false ); if ( strlen( $title ) > 0 ) echo substr_replace( $title, ' ', strrpos( $title, ' ' ), 1 );
This will look at the last space character in the title and replace it with a non-breaking space character meaning that the last word will always stick to the one before it, hence if the title wraps it’ll be at least two words. Let’s hope the two words are not “is it” :) Anyone know of a CSS solution that can do this?