Forums
Home / Themes and Templates / Posts from Selected Categories
(@tariqbamadhaj)
15 years, 12 months ago
How do I show the titles of posts/articles from a selected group of categories? I would like to place this list (which consist of the 10 most recent articles/post) in the sidebar. Any suggestions?
(@markdw)
You could use the following code (see entry below)
sorry this editor is playing up. Try this code:
<?php $recent = new WP_Query("cat=22&showposts=10"); while($recent->have_posts()) : $recent->the_post();?> <h2><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h2> <?php endwhile; ?>