WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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

Is it possible to control the length of the content or excerpt for a specific query/loop?

I have come across the following code, but this changes the length for all excerpts, I want it focused on a specific custom query.

    add_filter('excerpt_length', 'my_excerpt_length');
function my_excerpt_length($length) {
return 20; }
share|improve this question
up vote 1 down vote accepted

Try this: http://pippinspages.com/tutorials/better-wordpress-post-excerpt-revamped/

share|improve this answer
Ah, there it is. Your article was the one I was actually looking for.... I remembered reading it, but forgot who wrote it. – Rev. Voodoo Mar 10 '11 at 20:13
Excellent, glad it was helpful. – Pippin Mar 10 '11 at 20:33

http://wpengineer.com/1909/manage-multiple-excerpt-lengths/ Does this work for you?

Can apply different excerpts to each time you actually call the_excerpt

share|improve this answer

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.