1
2
3
4
5
6
7
8
9
$limit = 50;
 
$title = get_the_title(); 
$length = strlen($title);
 
$the_title = substr($title, 0, $limit);
if ($length > $limit) $the_title .= '...';
 
echo $the_title;
How to truncate the post title

Leave a Reply

Your email address will not be published. Required fields are marked *