views:

39

answers:

2

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 can not 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? Thank you much!

<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(); ?>

Good One

Bad One

A: 

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; ?>
Aaron Harun
A: 
<?php endwhile; endif; ?>
</div><!--end post-->

Flip their places. If it doesn't help, please show us what while and what if are getting closed.

Vladimiroff
Weird sorry, that top empty gray box up there looks like it ate the first part of my code. It should show the loops open like so, <?php/*Template Name: Blog Postings Page*/?><?php get_header(); ?><?php if (have_posts()) : while (have_posts()) : the_post(); ?>
thatryan
Yup, my solution will fix it.
Aaron Harun
Hmm odd. I made that change but no effect. I am not sure what is updating now... I added a generic <h1>HERE!</h1> under the main div to see if it showed, and it does not appear. But altering the name of the template changes the template name used for the post. I am confused.
thatryan
Then there is another error also.
Aaron Harun
We're going to need the full template file, cuz there are some other errors. But I'm pretty sure that the div, closing post should be BEFORE <?php endwhile; endif; ?>.
Vladimiroff