Title: last posts in single.php
Last modified: August 19, 2016

---

# last posts in single.php

 *  [hamdialkan](https://wordpress.org/support/users/hamdialkan/)
 * (@hamdialkan)
 * [17 years, 6 months ago](https://wordpress.org/support/topic/last-posts-in-singlephp/)
 * Hi there,
 * I want to list last 10 posts from a category in single.php, but I can’t. First
   I tried that one:
 * `<?php query_posts('cat=3&showposts=10&orderby=title&order=ASC'); ?>`
 * But it seems that that code doesn’t work inside the loop.
 * Then I tried that one:
 *     ```
       <?php
        $posts = get_posts('numberposts=10&category=3');
        foreach($posts as $post) :
        ?>
       ```
   
 * This time it worked, but one little problem: The comments on my blog didn’t show
   up! I mean visitors can add comments to the database, but it doesn’t show up 
   in single.php.
 * Any help?

Viewing 1 replies (of 1 total)

 *  Thread Starter [hamdialkan](https://wordpress.org/support/users/hamdialkan/)
 * (@hamdialkan)
 * [17 years, 6 months ago](https://wordpress.org/support/topic/last-posts-in-singlephp/#post-931758)
 * But really, it shouldn’t be that hard.

Viewing 1 replies (of 1 total)

The topic ‘last posts in single.php’ is closed to new replies.

## Tags

 * [last posts](https://wordpress.org/support/topic-tag/last-posts/)
 * [single.php](https://wordpress.org/support/topic-tag/single-php/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 1 reply
 * 1 participant
 * Last reply from: [hamdialkan](https://wordpress.org/support/users/hamdialkan/)
 * Last activity: [17 years, 6 months ago](https://wordpress.org/support/topic/last-posts-in-singlephp/#post-931758)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
