Categories

Getting posts from a category

The following example shows how to request post from an specific category ID. It also show how to limit the number of results.

<?php
$postslist = get_posts('numberposts=2&category=10');
foreach ($postslist as $post) : 
setup_postdata($post);
?> 
 <div class="post">
	 <h3 class="post-title"><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h3>  
	 <div class="entry">
	 	<?php the_excerpt(); ?>
	 </div>
 </div>
 <div class="content_bottom"></div>
<?php endforeach; ?>

Leave a Reply

 

 

 

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

IMPORTANT! To be able to proceed, you need to solve the following simple math (so I know that you are a human) :-)

What is 15 + 11 ?
Please leave these two fields as-is: