I have a new, custom theme that I've uploaded on a pre-existing site/blog. Everything seems to be working ok, with the exception of the older blog posts not showing up. Any ideas what I can do to fix?

<?php get_header();?>

<div id="blog-container">
    <?php get_sidebar( 'blog');?>
    <div class="content">
    <?php if(have_posts()) : while(have_posts()) : the_post(''); ?>
        <div class="meta">
            <h3><a href="<?php the_permalink(); ?>"><?php the_title(); ?></h3>
            <p><span style="font-size:85%"><?php the_tags('tags: ', ', ', '<br />'); ?> | <?php comments_number( 'no responses', 'one response', '% responses' ); ?> comments</span></p>
        </div><!-- end meta -->
        <div class="post">
            <?php the_content('read more...'); ?>
        </div><!-- end post -->
        <div class="share">
            <span class="left-border"></span><!-- end border -->
            <p style="font-family:nevis-webfont;">SHARE THIS POST</p>
            <span class="right-border"></span><!-- end border -->
        </div><!-- end share -->
    </div><!-- end content -->
    <?php endwhile; ?>
    <?php else : ?>
            <p>I'm not sure what you're looking for.</p>
    <?php endif; ?>
</div><!-- end blog-container -->

<?php get_footer();?>

eta Finally got the posts to show by cleaning up the code, however they are now all jumbled. How can I remedy this?

  • Your blog posts index is displaying all 40 posts: frshstudio.com/blog Mar 5, 2013 at 12:36
  • I'd keep the 'query_posts' in the question, if i were you
    – Makan
    Jan 3, 2017 at 23:03

2 Answers 2


What posts exactly are not shown? In your code there are no page links (pagination). Could it be that you just see the the number of posts according to the respective admin setting?

In addition, I just have been learned NOT to use query_posts. Why would you use it there anyway? Assuming, this is a post-showing template (e.g., index, front-page), you just have to write:

<?php while (have_posts()) : the_post(); ?>
<?php endwhile; ?>
  • I've just removed query_posts, and am still unable to see the 40 posts pre-existing on this site. Just updated my original code to reflect what is currently on my site. Any ideas what could be going on? Mar 5, 2013 at 1:50
  • So, I take it you have set the number of posts in the admin settings to 40, right?
    – tfrommen
    Mar 5, 2013 at 1:53
  • No, the number of posts I currently have set to show in Settings - Reading is 1000(changed just to rule out any issues in the Settings). However, the number of posts I have actually made is only 40. Mar 5, 2013 at 1:56
  • Okay, and how many posts of the existing 40 DO you see?
    – tfrommen
    Mar 5, 2013 at 1:58
  • I don't see any, that's my problem. Sorry, I thought I linked to my site, it's frshstudio.com.. maybe that will help. Mar 5, 2013 at 2:57

Get rid of query_posts(). It is causing your pagination problem.

For more detailed information, see this question.

For alternatives when you need to modify the main loop query, or add secondary queries, see this question.


Based on your edit removing query_posts(), your next issue is that you don't provide any navigation links.

Here's recommended navigation markup from the Codex, using previous_posts_link() and next_posts_link():

<div class="navigation">
<div class="alignleft"><?php previous_posts_link('&laquo; Previous Entries') ?></div>
<div class="alignright"><?php next_posts_link('Next Entries &raquo;','') ?></div>

See also, this DigWP post on WordPress navigation.

  • Thanks for your input, I always find your answers to be helpful. I've removed query_posts() as I've determined it to be not of any use or importance, yet my problem persists. Any ideas? Mar 5, 2013 at 1:53
  • See updated answer. You need to provide navigation links. :) Mar 5, 2013 at 1:54
  • I added the navigation links just before the end of the loop as well as just before <?php endwhile; ?>, still no posts being shown :/ Mar 5, 2013 at 3:38
  • Your blog posts index is showing all 40 posts: frshstudio.com/blog Check Dashboard -> Settings -> Reading and verify your setting for # of posts to display per page. Also, what Plugins do you have active? Do you have any custom code in functions.php that may be modifying posts_per_page? Mar 5, 2013 at 12:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.