WordPress limit the length of the post title

This post is describing how to reduce/ limit the length of the post title.This is you want when you have long title of a post or page.Here is the way to limit the length of the title of wordpress.

First, we’ll see default wordpress method/function to get post title.


Above function is displaying full length of the title.

How to limit the length of the post title?

$new_title = the_title('','',FALSE);
echo substr($new_title, 0, 50);
if (strlen($new_title) > 50) echo " ....";

So the output like this.
Lorem ipsum dolor sit amet consectetuer ....
That’s only.Remember you know this is working in the while loop of the post details.