I have a page set up to show only posts from one category, which I’m calling using the php query_posts function. How to I make it so that the posts are displayed as excerpts only, not as full articles?
Here’s the code I’m using on the page:
<?php query_posts('category_name=news&showposts=10'); ?>
<?php while (have_posts()) : the_post(); ?>
<?php endwhile;?>
*incorporated WordPresses excerpt function:
<?php query_posts('category_name=news&showposts=10'); ?>
<?php while (have_posts()) : the_post(); ?>
<?php the_excerpt(); ?>
<?php endwhile;?>
Now I’m seeing first a list of the excerpts that I want followed by a repeat of the posts in the entirety…
There is a core WordPress method that does that exactly :
http://codex.wordpress.org/Function_Reference/the_excerpt
And to control the length of the excerpt :
http://codex.wordpress.org/Function_Reference/the_excerpt#Control_Excerpt_Length_using_Filters