Post Excerpt Length

Support Area Forums Epic Post Excerpt Length

Viewing 3 posts - 1 through 3 (of 3 total)
URL to the page in question:
  • Author
    Posts
  • #7252
    elwynvds
    Participant

    Hi Bill

    You mention, via this post, that the post excerpt is the first 55 words of a particular post.

    Is it possible to change this to a smaller number?

    I would like to have shorter excerpts via the Home Page Posts widget without having to install a separate plugin to achieve this.

    Thanks.

    #7265
    Bill Robbins
    Moderator

    Great question. You can have a shorter excerpt. Here’s how to do that:

    1. Go to the appearance section of your WordPress control panel and select edit.
    2. From the list of files on your right, choose functions.php.
    3. Scroll down to the very bottom and paste this just above the ?>
      
      function elwynvds_custom_excerpt_length( $length ) {
      	return 20;
      }
      add_filter( 'excerpt_length', 'elwynvds_custom_excerpt_length', 999 );
      
    4. Save your changes.

    That will change the default excerpt length from 55 words to 20. To choose a different number, just change the “20” in the snippet above.

    If you run into any questions or trouble, let me know,
    Bill

    #7326
    elwynvds
    Participant

    Awsome! Works as expected.

    Thanks Bill.

Viewing 3 posts - 1 through 3 (of 3 total)
  • The topic ‘Post Excerpt Length’ is closed to new replies.