Title: Only showing 5 posts
Last modified: August 19, 2016

---

# Only showing 5 posts

 *  Resolved [noelgreen](https://wordpress.org/support/users/noelgreen/)
 * (@noelgreen)
 * [18 years, 1 month ago](https://wordpress.org/support/topic/only-showing-5-posts/)
 * I’m using the [Post Image plug-in](http://guff.szub.net/post-image) and have 
   this code on my sidebar to show all the image thumbnails of recent posts in a
   certain category:
 *     ```
       <?php $posts = get_posts('category=6&showposts=40');
       foreach ($posts as $post) : start_wp(); ?>
   
       <a href="<?php the_permalink() ?>" rel="bookmark" title="Buy this..."><?php post_image('default_image', 'use_thumb=1'); ?></a>
   
       <?php endforeach; ?>
       ```
   
 * It’s working fine, but its only showing the last 5 posts. Even if I change it
   so it’s just the post content (the_content) instead of the plug-in info, last
   five posts. Even if I delete the entire content of the main page, still only 
   five.
 * I’ve looked through my settings and every plug-in setting I know of I’ve even
   deactivated all my plug-ins. I’ve opened every file in my template and searched
   for anywhere that has “showposts” and changed and removed it and nothing.
 * Why would this be showing only 5 posts??
    Any idea?

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

 *  [boober](https://wordpress.org/support/users/boober/)
 * (@boober)
 * [18 years, 1 month ago](https://wordpress.org/support/topic/only-showing-5-posts/#post-741898)
 * i feel bad, you always seem to have questions no one can answer. i cant really
   help. the only thing i can think of is your “Show at most:” setting in your reading
   options. but i really doubt that would over ride your settings.
 * p.s. i failed your muppet test cause boober wasnt on it 🙁
 *  Thread Starter [noelgreen](https://wordpress.org/support/users/noelgreen/)
 * (@noelgreen)
 * [18 years, 1 month ago](https://wordpress.org/support/topic/only-showing-5-posts/#post-741906)
 * Hahaha… that’s very nice, thanks! 😀
 * I’m glad people are at least LOOKING at my posts. And I think you’re the first
   person I know who’s failed [the Muppet Test](http://www.noelgreen.com/muppet-test)!(
   I should add Boober.)
 * Hopefully someone will be able to help on this one at least.
 *  [TrishaM](https://wordpress.org/support/users/trisham/)
 * (@trisham)
 * [18 years, 1 month ago](https://wordpress.org/support/topic/only-showing-5-posts/#post-741908)
 * Ok here’s a dumb question – but what DO you have as the number in Settings>Reading
   Blog pages show at most XX posts?
 *  [Len](https://wordpress.org/support/users/lenk/)
 * (@lenk)
 * [18 years, 1 month ago](https://wordpress.org/support/topic/only-showing-5-posts/#post-741912)
 * Try this. On a local install I got it to spit out the same 15 images with excerpts
   while the main page is set to display only 5 posts. You’ll have to play around
   with it to get the result you want but it should get you started.
 *     ```
       <?php query_posts('category_name=test&showposts=15'); ?>
       <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
       <a href="<?php the_permalink() ?>" rel="bookmark" title="Buy this..."><?php post_image('/your/image/path/pic.gif', true); ?></a>
       <?php the_excerpt(); ?>
       <?php endwhile; ?><?php endif; ?>
       ```
   
 *  Thread Starter [noelgreen](https://wordpress.org/support/users/noelgreen/)
 * (@noelgreen)
 * [18 years, 1 month ago](https://wordpress.org/support/topic/only-showing-5-posts/#post-741976)
 * **TrishaM** – never a dumb question, or at least sometimes the dumb questions
   are the ones I’ve overlooked… however, not in this case. It is set to 10, and
   I had tried setting it to 99. But thanks!
 * **LenK** – That did it! 🙂
    Not sure what is different except you’re using “category_name”
   instead of “cat” and you have the “endwhile” and “endif” instead of the “endforeach”…
   but I don’t care why it’s working… it’s just working!
 * Thanks!
 *  Thread Starter [noelgreen](https://wordpress.org/support/users/noelgreen/)
 * (@noelgreen)
 * [18 years, 1 month ago](https://wordpress.org/support/topic/only-showing-5-posts/#post-741979)
 * Actually to get them to appear on ALL the pages (not just the homepage) I had
   to use this code:
 *     ```
       <?php $posts = query_posts('category_name=sidebar&showposts=-1');
       foreach ($posts as $post) : start_wp(); ?>
   
       <a href="<?php the_permalink() ?>" rel="bookmark" title="Buy this..."><?php post_image('default_image', 'use_thumb=1'); ?></a>
       <?php endforeach; ?>
       ```
   
 * It was the “query_posts” instead of “get_posts” that did it though.
 * Thanks again everyone!
    And see **boober**… I get my questions answered now and
   then. 😀
 *  Moderator [Samuel Wood (Otto)](https://wordpress.org/support/users/otto42/)
 * (@otto42)
 * WordPress.org Admin
 * [18 years, 1 month ago](https://wordpress.org/support/topic/only-showing-5-posts/#post-741982)
 * Your basic problem is that you didn’t make a proper Loop correctly. Even your
   later example is incorrect and can cause other issues. I mean, it works, but 
   only as a sort of side effect.
 * Here’s a corrected example:
 *     ```
       <?php query_posts('category_name=sidebar&showposts=-1');
       while(have_posts()): the_post(); ?>
       <a href="<?php the_permalink(); ?>" rel="bookmark" title="Buy this..."><?php post_image('default_image', 'use_thumb=1'); ?></a>
       <?php endwhile; ?>
       ```
   
 * However, this will mess with the main Loop and so it’s not a good thing to put
   in a sidebar. A better example would be this:
 *     ```
       <?php $my_query = new WP_Query('category_name=sidebar&showposts=-1');
       while($my_query->have_posts()): $my_query->the_post(); ?>
       <a href="<?php the_permalink(); ?>" rel="bookmark" title="Buy this..."><?php post_image('default_image', 'use_thumb=1'); ?></a>
       <?php endwhile; ?>
       ```
   
 * This second one uses a separate query to avoid contaminating the main one.
 *  [boober](https://wordpress.org/support/users/boober/)
 * (@boober)
 * [18 years, 1 month ago](https://wordpress.org/support/topic/only-showing-5-posts/#post-742029)
 * woohoo noelgreen! im glad the real experts were able to fix it!!

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

The topic ‘Only showing 5 posts’ is closed to new replies.

## Tags

 * [get_posts](https://wordpress.org/support/topic-tag/get_posts/)
 * [posts](https://wordpress.org/support/topic-tag/posts/)
 * [showposts](https://wordpress.org/support/topic-tag/showposts/)
 * [wordpress 2.5](https://wordpress.org/support/topic-tag/wordpress-2-5/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 8 replies
 * 5 participants
 * Last reply from: [boober](https://wordpress.org/support/users/boober/)
 * Last activity: [18 years, 1 month ago](https://wordpress.org/support/topic/only-showing-5-posts/#post-742029)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
