Connect with us

Tips & Tricks

Limit the characters that display on the_title

Ever wanted to display the title of a post somewhere but limit the amount of characters that are shown? For instance, this post has a very long title, and if I were to use <?php echo the_title() ?> it would show as follows: Limit the characters that display on the_title.

That may not fit well on one line in lets say a widget or small width div. So here is a neat trick you can use:

<?php $title = the_title('','',FALSE); echo substr($title, 0, 11); ?>

Pretty simple huh, just note the bold numbers, in this case 11 character would output like this: Limit the c.

Thanks to Tattershall Way for this snippet.

3 Comments

3 Comments

  1. Pingback: WordPress links week 4 - 2009 | WPStart.org - WordPress themes, plugins and news

You must be logged in to post a comment Login

Random Search Terms

Title

Top Articles

powered by WassUp

Recent Posts: Fully Net Worth . com

Marie Osmond Net Worth: 5 Interesting Facts You Should Know

Marie Osmond Net Worth: 5 Interesting Facts You Should Know

Marie Osmond is an American actress, singer, and designer. She gained international recognition in the 1970s after her success in country music. Marie is also known for hosting the television variety show “Donny & Marie” with her brother Donny Osmond. Here are five interesting facts about Marie Osmond 1. Marie Osmond net worth is estimated […]

Blueface Net Worth: 5 Interesting Facts About the Rapper

Blueface Net Worth: 5 Interesting Facts About the Rapper

Blueface Bleedem, or simply Blueface, is an American rapper from Los Angeles currently signed to Birdman’s Cash Money West label. He rose to fame after releasing single ‘Deadlocs’ on music platform SoundCloud. The song has received more than 2.5 million streams. Here are some of the interesting facts about Blueface. 1. Blueface net worth is […]

FaZe Tfue Net Worth: 5 Interesting Facts You Should Know

FaZe Tfue Net Worth: 5 Interesting Facts You Should Know

Turner Tenney, professionally known as FaZe Tfue or Tfue is an American gamer, Twitch streamer and a member of FaZe Clan. Some people considered him the better player than Ninja and also ‘The Best Player in the World’. Here are some of the interesting facts about Faze Tfue including his path to success, net worth, […]