Latest Post

Limit Post title to 25 characters in wordpress

Limit Post title to 25 characters in wordpress

Limit Post title to 25 characters in wordpress


This code is for 25 characters short your post title than is use,.

Step - 1


<?php
function short_title( $after = '', $length ) {
    $mytitle = get_the_title();
    if( mb_strlen( $mytitle ) > $length ) {
        $mytitle = substr( $mytitle, 0, $length );
        echo $mytitle . $after;
    } else echo $mytitle;
}
?>

Step - 2


<?php short_title( '...', 30 ); ?> 

No comments