WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
up vote 2 down vote accepted

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.

share|improve this answer
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. – daysrunaway Aug 22 '11 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 Aug 22 '11 at 23:21
Thanks @tollmanz, it turns out I can just use the wp_trim_excerpt() function to get the abbreviated excerpt. – daysrunaway Aug 25 '11 at 17:12

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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