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

Top Searches

powered by WassUp

Recent Posts: Fully Net Worth . com

Danny Towers Net Worth: How Rich is the Puerto Rican Rapper?

Danny Towers Net Worth: How Rich is the Puerto Rican Rapper?

Danny Towers is an upcoming rapper who is best known for his songs “‘Motel Hell”, “Geekin”, and “Trauma”. He is currently on tour with Ski Mask The Slump God and was a good friend to late XXXTentacion. As of 2019, Danny Towers net worth is estimated to be $300,000. Danny was born on April 17, […]

Michael Strahan Net Worth.

Michael Strahan Net Worth.

Michael Strahan Net Worth Who does not like that rigorous American Football game that makes your adrenaline take a toll even though you would be just sitting on a chair amongst the spectators?! Everyone does. The mere sight of the game is enough for people to make them sit on the edge of their seats […]

Paul Nassif net worth

Paul Nassif net worth

Paul Nassif net worth Dr. Paul Nassif is a famous plastic surgeon, and he is an expert in the field of rhinoplasty. Dr. Nassif is a Lebanese-American who has jokingly commented on his big nose. He has said that he understands when many people wish to change their features. He began his career with Dr. […]