Ask your WordPress questions! Pay money and get answers fast! (more info)

Show 1 post from 1 category in sidebar WordPress

  • SOLVED

Hello, I am using this code in my sidebar to show 1 latest post, but I want to only show the latest post from category ID=1.


Can someone edit this code for me to do this?

Thanks

<?php $archive_query = new WP_Query('showposts=1');
while ($archive_query->have_posts()) : $archive_query->the_post(); ?>
<a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title(); ?>"><?php the_title(); ?></a>
<?php endwhile; ?>

Answers (1)

2012-12-05

John Cotton answers:

$archive_query = new WP_Query('posts_per_page=1&cat=1');