WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a custom post type to get images. I am setting up my theme to display a specific way when it is first installed. For some reason, my code is stopping the bottom half of my page from displaying.

 <div id="gallery">
    <?php if( $loop->has_posts()): ?>
    <hr />
    <h1 class="tag-background"><span class="background">FROM THE GALLERY</span></h1>
        while ( $loop->have_posts() ) : $loop->the_post(); ?>
           <li><?php if ( has_post_thumbnail()) : ?>
                        <a href="<?php the_permalink(); ?>" title="<?php the_title_attribute();?>"><?php the_post_thumbnail('frontpage_gallery'); ?></a> </li>
                 <?php endif; ?>
            <?php endwhile; ?>
        <?php endif; wp_reset_query();?>
</div><!--END gallery-->

When I view source, the only part of the gallery div that shows above is the opening div. Everything after that including the footer is gone. This happened when I put all the gallery stuff between the if statement. What am I missing?

 if( $loop->has_posts()):

share|improve this question
up vote 0 down vote accepted

I think your issue is $loop->has_posts(). Try $loop->have_posts().

share|improve this answer
I am such a dork. I should have seen that. Thanks. That fixed my issue – Jamie Dec 4 '12 at 4:33
We've all been there. Sometimes all it takes is a second set of eyes! – Matthew Boynes Dec 4 '12 at 4:35

Your Answer


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.