Limit Post title to 25 characters in WordPress

Limit-Post-title-to-25-characters-in-wordpress

This code is 25 characters short of your post title than is used in WordPress.

Step - 1 : this code add your function.php file
<?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 : This code add your custom file.

<?php short_title( '...', 30 ); ?> 
Learn Tutorials Point
We Well organized and easy-to-understand Interactive tutorials With lots of examples of how to use Tutorials WordPress, PHP, Bootstrap, Bootstrap 4, HTML, CSS, AJAX, jQuery, Woocommerce, Post, Database, Javascript, Theme, Responsive, Templates.

Leave a Reply

Your email address will not be published. Required fields are marked *

Contact us

Fill in the form below or give us a call and we'll contact you. We endeavour to answer all enquiries within 24 hours on business days.