Change the number of words in Excerpt mode view

  • 007me



    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?



    Prasanna SP


    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.




    Where should I add this function? In which file?



    functions.php of the child theme



    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




    read these posts first


    This is on prasanna’s signature

    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:


    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:

    Many thanks.



    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…




    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.





    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?


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

You must be logged in to reply to this topic.

Do NOT follow this link or you will be banned from the site!