Title: query_posts() in single.php with next button
Last modified: August 19, 2016

---

# query_posts() in single.php with next button

 *  [patriktg](https://wordpress.org/support/users/patriktg/)
 * (@patriktg)
 * [15 years, 6 months ago](https://wordpress.org/support/topic/query_posts-in-singlephp-with-next-button/)
 * Hi.
    I’m trying to build a portfolio page. I have content (one post) in the single.
   php, and I have a query_posts() loop under wich shows thumbnails to the other
   posts. The ting is that i want a “more button”, so that i can show tree and tree
   thumbs.
 * This is the code i have, but the “more button” does not work.
 *     ```
       <?php query_posts('showposts=3'.'paged=' . get_query_var('paged')); while ( have_posts() ) : the_post() ?>
   
       <div class="post_excerpt" id="post-<?php the_ID(); ?>">
       <a href="<?php the_permalink() ?>"><?php the_post_thumbnail(array(200,200)); ?> </a>
       </div>
   
       <?php endwhile; ?>
       <p><?php posts_nav_link(); ?></p>
       ```
   

Viewing 3 replies - 1 through 3 (of 3 total)

 *  [vtxyzzy](https://wordpress.org/support/users/vtxyzzy/)
 * (@vtxyzzy)
 * [15 years, 6 months ago](https://wordpress.org/support/topic/query_posts-in-singlephp-with-next-button/#post-1762780)
 * The ‘more’ button only works for the_content().
 *  Thread Starter [patriktg](https://wordpress.org/support/users/patriktg/)
 * (@patriktg)
 * [15 years, 6 months ago](https://wordpress.org/support/topic/query_posts-in-singlephp-with-next-button/#post-1762809)
 * Yes, I get that, but surely there has to be a way around that?
    Some way to show
   three posts and then the next three posts and so on.
 *  [vtxyzzy](https://wordpress.org/support/users/vtxyzzy/)
 * (@vtxyzzy)
 * [15 years, 6 months ago](https://wordpress.org/support/topic/query_posts-in-singlephp-with-next-button/#post-1762811)
 * OK – I misunderstood what you wanted. I thought you wanted 3 more images from
   the same page.
 * I think your query string is missing an ampersand just ahead of paged=:
 * `<?php query_posts('showposts=3'.'&paged=' . get_query_var('paged'));`

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘query_posts() in single.php with next button’ is closed to new replies.

## Tags

 * [loop](https://wordpress.org/support/topic-tag/loop/)
 * [query](https://wordpress.org/support/topic-tag/query/)
 * [query_posts](https://wordpress.org/support/topic-tag/query_posts/)
 * [single.php](https://wordpress.org/support/topic-tag/single-php/)
 * [thumbnail](https://wordpress.org/support/topic-tag/thumbnail/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 3 replies
 * 2 participants
 * Last reply from: [vtxyzzy](https://wordpress.org/support/users/vtxyzzy/)
 * Last activity: [15 years, 6 months ago](https://wordpress.org/support/topic/query_posts-in-singlephp-with-next-button/#post-1762811)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
