I have a wordpress site with titles, and if the title has more than 50 characters I need to add an ellipsis (...) at the end of the title and stop the title at 50 characters. Be
Add this to your "functions.php" file in your theme folder....
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;
}
}
then call the title like as follows