0

I am looking to display a shortened version of a blog post's title one the main page of the blog with a thumbnail for the post. I have found lots of info on how to display just an excerpt of the post, but can't find anything on how to shorten the length of test shown as the title.

Any help would be amazing! Thanks!

Nate
  • 3
  • 1

1 Answers1

0

There is no such functionality in Wordpress..

EDIT: Take a look at the the_title hook.

https://codex.wordpress.org/Plugin_API/Filter_Reference/the_title

You can use the hook in combination thing with something like:

$out = strlen($in) > 50 ? substr($in,0,50)."..." : $in;

Or add a class to your title with css:

.ellipsis {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

Found on Add ... if string is too long PHP

Florian
  • 725
  • 6
  • 27