Change the number of words in Excerpt mode view

  • 007me

    #5337

    Hi,

    In Excerpt mode each post display 55 words before it shows the “continue reading” button.

    Any way to change this number of words?

    And also make show like it should be? every row in a new row? and not the whole words one after the other with no row break?

    Thanks,

    Udi.

    Prasanna SP

    #31626

    Try this function,

    function custom_excerpt_length($length) {
    return 40;
    }
    add_filter('excerpt_length', 'custom_excerpt_length');

    Here I’ve set the number of words to 40. Change it to whatever the number.

    007me

    #31627

    Prasanna,

    Where should I add this function? In which file?

    ronangelo

    #31628

    functions.php of the child theme

    007me

    #31629

    Can you please explain what do you mean by child theme and where exactly in the functions.php?

    I have functions.php and theme-functions.php

    ronangelo

    #31630

    007me

    #31631
    Quote:
    read these posts first

    graphene-support/how-to-modify-the-theme-using-a-child-theme

    This is on prasanna’s signature

    http://www.prasannasp.net/graphene-child-theme-template/

    read the post, and still can’t figure out how to make this child theme to work.

    I’ve created it as explained, created also the functions.php added the following code into it:

    <?php

    function custom_excerpt_length($length) {

    return 30;

    }

    add_filter(‘excerpt_length’, ‘custom_excerpt_length’);

    ?>

    But the posts are still with the 55 words.

    Any better guide? as the one in the link shows only what to do with the style.css.

    I’m doing all tests here: http://www.udiburg.com/blog2

    Many thanks.

    Josh

    #31632

    Your child theme looks set up correctly. It is adding to your site… and pulling the parent theme stylesheet. This is correct.

    Regarding the functions.php file. It should sit along side the style.css file.

    = wp-content

    == themes

    === graphene

    === graphene-child

    ==== style.css

    ==== functions.php

    Here is a video I threw together a few months ago…

    http://www.joshlobe.com/2011/10/video-tutorial-creating-a-child-theme-in-wordpress/

    007me

    #31633

    Josh,

    Thanks. that’s nice, watched the video but this is only for the style.css.

    How can I force the changes that made in functions.php to work?

    It sits along with the style.css but the code I put there doesn’t work.

    Thanks.

    007me

    #31634

    Josh,

    Also, If I would like to keep settings of additions that I made in specific PHP files how do I keep them in the child theme?

    What will happen if these files will have major changes during upgrade?

    Thanks,

    Prasanna SP

    #31635

    Okay, install this plugin. This should limit excerpt length to 30 words — Custom Excerpt Length SP

    http://www.prasannasp.net/download/custom-excerpt-length-sp.zip

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

You must be logged in to reply to this topic.