Custom WordPress Post Page Breaks if More Than 2 Posts?

I have a very custom template, and it works great if there are 1 or 2 posts on the blog page. But as soon as a 3rd post is added, it alters the structure of the template… Literally moves a div inside of another and I cannot understand why. The code for the blog template is here, and a screenshot of the structure as it should be and another showing the misplaced div when a third post is there. Does this make any sense, any ideas?

<div class="post" id="post-<?php the_ID(); ?>"><!--start post-->

        <h2><?php the_title(); ?></h2>

        <div id="main_full" class=" clearfix"><!--start main-->

            <div id="top_bar"><h3 class="gallery-title">news</h3></div>

                <div id="blog_page"><!--start blog page-->

                    <div class="entry"><!--start entry-->

                        <?php the_content(); ?>

                    </div><!--end entry-->

                </div><!--end blog page-->

        </div><!--end main-->

    <?php endwhile; endif; ?>

    </div><!--end post-->

<?php edit_post_link('Edit this entry.', '<p>', '</p>'); ?>

<?php comments_template(); ?>

Related posts

Leave a Reply

2 comments

  1. Without seeing the beginning of your loop, I can’t be 100% sure, but it looks like you need to have:

    <?php endwhile; endif; ?>
    
        </div><!--end post-->
    

    be

         </div><!--end post-->
    <?php endwhile; endif; ?>