Footer moved outside the wrapper
-
Hi there,
I was playing around in my index.php to customize content and the footer came outside the wrapper. what did i do wrong?<?php get_header(); ?> <section id="content" role="main"> <div class="homepost"> <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?> <?php the_post_thumbnail(); ?> <div class="intros"> <a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a> <?php the_excerpt(); ?> </div> <?php the_category(); ?> </div> <?php comments_template(); ?> <?php endwhile; endif; ?> <?php get_template_part( 'nav', 'below' ); ?> </section> <?php get_sidebar(); ?> <?php get_footer(); ?>I have created some divs to separate content and the problem appeared.
Thanks
-
The old school way — print out the source code of the page and use a pencil to connect <div> to </div> until you find where you have an extra one or a missing one.
As you can see all divs are closed. Maybe im just doin it wrong. Thanks.
As you can see all divs are closed. Maybe im just doin it wrong. Thanks.
I can see your code, but not the output as you haven’t posted a link to your site. Please do so. Did you check the output HTML from View Source as I suggested?
As you can see all divs are closed.
what about divs in comments.php, and in nav-below.php, and in sidebar.php and all its widgets including textwidget contents, etc….?
also, if you look closely at the posted template code, you see that one div is opened before the loop, while the corresponding closing is within the loop…
Hi!
I’ve been viewing the source code and the .homepost is not being generated in the loop. Probably because, as Michael suggested, is not in the loop. I now understand that loops start with the “if”? Is that it? 🙂Is there a way to make that loop generate content with a div wrapping it everytime?
Thank you!
loop starts with
while.have a look at https://codex.wordpress.org/The_Loop_in_Action
The topic ‘Footer moved outside the wrapper’ is closed to new replies.