Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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?

share|improve this question
    
Your blog posts index is displaying all 40 posts: frshstudio.com/blog –  Chip Bennett Mar 5 '13 at 12:36

2 Answers 2

up vote 1 down vote accepted

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(); ?>
DO YOUR POST STUFF
<?php endwhile; ?>
share|improve this answer
    
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? –  user1255049 Mar 5 '13 at 1:50
    
So, I take it you have set the number of posts in the admin settings to 40, right? –  t f Mar 5 '13 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. –  user1255049 Mar 5 '13 at 1:56
    
Okay, and how many posts of the existing 40 DO you see? –  t f Mar 5 '13 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. –  user1255049 Mar 5 '13 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.

Edit

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>
</div>

See also, this DigWP post on WordPress navigation.

share|improve this answer
    
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? –  user1255049 Mar 5 '13 at 1:53
    
See updated answer. You need to provide navigation links. :) –  Chip Bennett Mar 5 '13 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 :/ –  user1255049 Mar 5 '13 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? –  Chip Bennett Mar 5 '13 at 12:37

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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