WordPress post title Limit to 50 characters




How can you create Limit/small characters in your your WordPress loop title. 

You cane limit title 50 characters or your need. Its easy. 


Ad code your theme index.php or other page in loops

<?php the_titlesmall('', '...', true, '50') ?>


Ad code your themes functions.php 

function the_titlesmall($before = '', $after = '', $echo = true, $length = false) { $title = get_the_title();

if ( $length && is_numeric($length) ) {
$title = substr( $title, 0, $length );
}

if ( strlen($title)> 0 ) {
$title = apply_filters('the_titlesmall', $before . $title . $after, $before, $after);
if ( $echo )
echo $title;
else
return $title;
}

}




Comments


  1. Hello,

    we provide affordable and result-oriented SEO services, please give a chance to serve you.


    Thanks
    Admin: E07.net

    ReplyDelete

Post a Comment

Popular posts from this blog

Text Smooth Scrolling Marquee use jQuery