last three posts in a category
-
I would like to display just the titles of the last three posts in a category. Here is the code I wrote that works, but it messes up my entire page. I am pasting the code on my homepage (I don’t know if that makes a difference). Is there a better way to do this?
<?php $temp_query = $wp_query; ?> <?php query_posts('cat=4&showposts=3'); ?> <?php while (have_posts()) : the_post(); ?> <h5 id="post-<?php the_ID(); ?>"><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h5> <?php endwhile; ?> <?php $wp_query = $temp_query; ?>
Viewing 7 replies - 1 through 7 (of 7 total)
Viewing 7 replies - 1 through 7 (of 7 total)
- The topic ‘last three posts in a category’ is closed to new replies.