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 trying to make a page that has all the posts in it and shows 30% or less of the content of the post. So I'm editing a page template and I can't figure out how to show only 30% of the content. I'm new to this so please don't spam me with "go google it you noob" , stuff like that. Thank you in advance and have a nice day!

share|improve this question
i am sorry to spam you but you should check out the meaning of excerpt in wordpress codex.. codex.wordpress.org/Function_Reference/the_excerpt – Sagive SEO Apr 13 '13 at 20:38

Go with the_excerpt.

It does what it is supposed to do. Give you an excerpt of your post.

Traditionally, it is set to display the first 55 words of your post. You can tweak it using filters to give more (or less) if needed to be.


share|improve this answer

As Marco said, use the excerpt to achieve that.

You can change the the_excerpt() function length using the following filter

function my_excerpt_length($length) 
return 30; // Here is the new length of your excerpt
add_filter('excerpt_length', 'my_excerpt_length');

You can add it to your theme functions.php file.

Alternatively, you may want to create a new function where you can have a better control over the content that will be display, I use the following function to achieve that sometimes:

function excerpt($limit) 
$excerpt = explode(' ', get_the_excerpt(), $limit);
if (count($excerpt)>=$limit) 
    $excerpt = implode(" ",$excerpt).' ';
} else {
    $excerpt = implode(" ",$excerpt);
$excerpt = preg_replace('`\[[^\]]*\]`','',$excerpt);
return $excerpt;

You can then use it like this:

<?php echo excerpt(40); // 40 is the number of words that are going to be displayed ?>
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.