This is searchable archive of our old support forums, which operated from 2012 - 2016. To find out how to get support for your current theme, please visit our support page.

Truncate post list excerpt in child theme

  • Creator
  • #1702

    Is there a way to change the length of the post list truncated excerpt without changing the main theme files, eg. using a function?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Author
  • #1710
    Jason Bobich


    This wouldn’t have anything to do with the theme specifically. If you track back in WordPress core searching with your text editor from the_excerpt function, you’ll find the root of the except formatting comes from a function called wp_trim_excerpt.

    Then, inside we can see that there is a filter on the length of the excerpt called “excerpt_length” we can use.

    function my_excerpt_length( $length ) {
    	return 20; // # of words, default is 55.
    add_filter( 'excerpt_length', 'my_excerpt_length' );

    This is actually a good article about how to find the source of the excerpt and just how to tackle finding these things for yourself, but it looks like it was written before someone though to just add on a filter to length of excerpts.


    A very enlightening answer.

    Thank You!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The forum ‘Alyeska Responsive WordPress Theme’ is closed to new topics and replies.