WordPress: Latest Posts from Category

/ Published in: PHP
Save to your folder(s)

Used to display the latest X number of posts from the specified category.

Copy this code and paste it in your HTML
  1. <div class="pod">
  2. <h2>Latest Announcements</h2>
  3. <ul>
  4. <?php query_posts('cat=5&showposts=10'); ?>
  5. <?php while(have_posts()) : the_post(); if(!($first_post == $post->ID)) : ?>
  6. <li>
  7. <a href="<?php the_permalink() ?>" rel="bookmark" title="Permalink: <?php the_title(); ?>"><?php the_title(); ?></a>
  8. </li>
  9. <?php endif; endwhile; ?>
  10. </ul>
  11. </div>

Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.