Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #370447

    Hello Support,

    http://lw.bypundyk.com/blog/

    How can I limit the Titles to be only in one line instead of 2 or more.

    Hope to hear from anyone soon.

    Thanks,
    MP

    #370450

    Hey Marcelo!

    Change your layout from 1/3 to 1/2 columns to make more space for the titles and/or reduce its font size:

    strong.news-headline {
        font-size: 11px;
        line-height: 13px;
    }

    Cheers!
    Josue

    #370454

    Hello Josue,

    Actually is there a way to have a character limit on the title to eg: 33 characters.

    Once the user clicks and takes them to the full post then it will show the full title.

    Thanks,
    MP

    #370461

    Hi!

    Yes, there is a way using jQuery, please note that this is normally out of the scope, try adding this to theme / child theme functions.php:

    function add_custom_script(){
    ?>
    <script>
    (function($){
        $(window).load(function() {
        	$('.news-link').each(function(){
    			var $this = $(this);
    			var title = $this.attr('title');
    			var headline = $this.children('.news-headline');
    			var maxWords = 33;
    
    			if (title.length > maxWords){
    
    				headline.text($.trim(title).substring(0, maxWords).split(" ").slice(0, -1).join(" ") + "...");
    
    			}
    		});
        });
    })(jQuery);
    </script>
    <?php
    }
    add_action('wp_footer', 'add_custom_script');

    Adjust as needed.

    Regards,
    Josue

    #370614

    Thank you so much Josue.

    I have added the code in the child theme.
    FYI: You guys should have have another package of support for out of scope requests :)

    Either way thanks for the amazing support.

    MP

    #370679

    You are welcome, glad to help :)

    Regards,
    Josue

    #375843

    Thanks for your help.

Viewing 7 posts - 1 through 7 (of 7 total)
  • The topic ‘Blog Title Character Limit’ is closed to new replies.