I would like to show on the homepage sidebar a listing of recent posts titles from only one category.
I found this post:
and tried this code (i tried it on a page to test it)
4 is my category number
<ul> <?php query_posts('category_id=4&showposts=3');?> <?php $posts = get_posts('category=4&numberposts=3&offset=0'); foreach ($posts as $post) : start_wp(); ?> <li><a href="<?php echo get_permalink() ?>"><?php the_title(); ?></a></li> <?php endforeach; ?></ul>
and this is what it returns?
3 links back to the same page.
- The topic ‘Show Recent Posts/Title Only/One Category’ is closed to new replies.