How to reduce wordpress the_title string

reduce the titlehere i mention the how to reduce the title on wordpress the_title functions. please to watch this code was always working perfectly.

a) Template.php


<?php the_titlesmall('', '...', true, '100'); ?>

 

b) function.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;
}
}

Related Posts

Advertisement

No comments.

Leave a Reply