Sometimes clients have very specific requirements. Sometimes they want autometic controls on simple things they have total control over anyway. I digress.
In this case, blog titles needed to be of any length, but have their lengths truncated under certain circumstances. Furthermore, excerpts need to be able to be the default length (50 words), but shorter (10 words) under those same certain circumstances.
Fortunately for me, the excerpt was easily fixed using a plugin called the excerpt reloaded.
http://guff.szub.net/2005/02/26/the-excerpt-reloaded/
Next, for the title length requirements, you will need to modifiy a core file: wp-includes/post-template.php.
[php]
function the_title($before = ‘’, $after = ‘’, $echo = true, $length = false) {
$title = get_the_title();
if ( $length && is_numeric($length) ) {
$title = substr( $title, 0, $length );
}
if ( strlen($title) > 0 ) {
$title = apply_filters(‘the_title’, $before . $title . $after, $before, $after);
if ( $echo )
echo $title;
else
return $title;
}
}
[/php]
Finally, when in The Loop, call the_title() like this:
[php]< ?php the_title('', '', true, '40') ?>[/php]
Now, the title will be a mere 40 characters long, and the excerpt (using the_excerpt_reloaded()) can be any desired length.