Limit the post title in the loop by Character
Description
Put the function in the functions.php and update the character count inside the loop for the title
HTML Source Code
<?php the_title_excerpt('', '...', true, '50'); ?>
PHP Source Code
<?php
function the_title_excerpt($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_excerpt', $before . $title . $after, $before, $after);
if ( $echo )
echo $title;
else
return $title;
}
}
?>