I'm forced to use manual excerpts on a number of my posts to integrate them with a shortcode plugin. However, this is interfering with how they're being displayed on an archive page (using a page template). Is there a way to force WordPress to display an automated excerpt (ie, the first 80 words) on one page template only?

1 Answer 1


You can utilize the wp_trim_excerpt filter. In your callback function that filters the the excerpt text, you can test for the presence of a certain template; then, if that template is being used, you can go ahead and alter the excerpt in any way that you see fit. In order to determine which template is being used, see this clever solution: Get name of the current template file. Let me know if this helps or if you need more.

  • Hi @tollmanz, I can definitely do this (or even just use the built-in WordPress function, is_page_template(); I'm just not sure how to override the manual excerpt in the filter. Commented Aug 22, 2011 at 23:15
  • The wp_trim_excerpt is sent the manipulated text as the first parameter and the raw text as the second parameter. Are you comfortable working with filters? If so, look up wp_trim_excerpt in the core code. If not, I can help you along a little more.
    – tollmanz
    Commented Aug 22, 2011 at 23:21
  • Thanks @tollmanz, it turns out I can just use the wp_trim_excerpt() function to get the abbreviated excerpt. Commented Aug 25, 2011 at 17:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.