DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Snippets has posted 5883 posts at DZone. View Full User Profile

Display Recent Posts From A Category

05.11.2008
| 1571 views |
  • submit to reddit
        // No need of a plugin to do this

<ul>
 <?php
 global $post;
 $myposts = get_posts('numberposts=5&category=4');
 foreach($myposts as $post) :
 setup_postdata($post);
 ?>
 <li><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></li>
 <?php endforeach; ?>
</ul>.