WordPress Tutorial: Truncate Post Title

<?php  function customTitle($limit) { $title = get_the_title($post-ID); if(strlen($title) $limit) { $title = substr($title, 0, $limit) . '...'; } echo $title; }  ?> Instructions: This is just a fix on Josh McDonald’s snippet to remove the ‘…’ if the title is smaller...

We do not write or claim ownership of any of the articles featured on this website. Instead we aim to highlight them so you can read the full article at the original source. To finish reading this article, follow the continue reading link below. CONTINUE READING
Author: WP-Snippets

WP-Snippets is a website focused on creating useful content for WordPress developers. We’re dedicated to help anyone building WordPress websites, whether you’re a pro or if you just got started.

http://wp-snippets.com/

Sign up to our newsletter

Don't worry, we won't give your email to any third parties
and you can unsubscribe at any time.