what is the excerpt length on the front page?

Home Forums ColorMag Pro what is the excerpt length on the front page?

Tagged: ,

This topic contains 9 replies, has 4 voices, and was last updated by  Bishal Napit 3 years, 4 months ago.

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #1218905

    Binoy
    Participant

    Hi,

    Can you tell me what is the excerpt length for articles on the front page and widgets?
    Can that be altered?
    I want a length of 140 characters for each excerpt displayed on the TG widgets

    #1218952

    Bishal Napit
    Moderator

    Hi, Binoy.

    The excerpt length for this theme is 20. But, if you want to increase the value of the excerpt length, then, you can do it via the child theme. Thanks.

    #1219175

    Binoy
    Participant

    thank you Bishal.
    Is it 20 words?
    Can you give me the steps to change it to 140 characters?

    #1219375

    Bishal Napit
    Moderator

    Hi, Binoy.

    Please create the child theme and add this code in the child theme’s ‘functions.php’ file:-

    <?php
    remove_filter( 'excerpt_length', 'colormag_excerpt_length', 12 );
    add_filter( 'excerpt_length', 'colormag_excerpt_length_child', 12 );
    function colormag_excerpt_length_child( $length ) {
       return 140;
    }
    ?>

    Thanks.

    #1219478

    Binoy
    Participant

    Hi Bishal,

    This is giving me 140 words. I wanted 140 characters

    #1219656

    Bishal Napit
    Moderator

    Hi, Binoy.

    The excerpt will count the words, not the characters used in the post. So, to make those 140 characters, you need to edit the post and then add the manual excerpt of 140 characters in the Excerpt section in the post editor page. Thanks.

    #1221187

    Leakhana
    Participant

    I don’t know child theme. could you explain and guide me.

    #1221188

    Bishal Napit
    Moderator

    Hi, Leakhana.

    Here is the link on creating a child theme: https://themegrill.com/blog/tutorial-on-creating-wordpress-child-theme/. Thanks.

    #1238507

    ranjit2work
    Participant

    function colormag_excerpt_length( $length ) {
    return 20;
    }

    ok above code for the 20 words. ok but its not supporting the formatting of character or words like new line, bold etc.. so i just want to little modification .. so pls help me how can i print 20 words with the same formatting…

    #1238720

    Bishal Napit
    Moderator

    @ranjit2work

    You may need to edit that post and then add the manual excerpt for that post and check. Thanks.

Viewing 10 posts - 1 through 10 (of 10 total)

You must be logged in to reply to this topic.