I use this query in my sidebar to get the last 8 posts from a category (and it’s subcategories):
<?php $result = "<ul class='latest'>"; $catposts = get_posts('category=19&numberposts=8'); foreach ($catposts as $single): $result .= '<li><a href='; $result.=get_permalink($single->ID).'>'.$single->post_title.'</a></li>'; endforeach; $result .= "</ul>"; echo $result; ?>
Now i’m stuck in finding a way to show each results’ category name and post date.
Thx in advance.
- The topic ‘Showing category in posts query’ is closed to new replies.