Sidebar Appears Under Content On Pages, Works On Main/Posts?
-
Hey everyone,
I have been banging my head against my keyboard trying to figure out a problem I’m having with my site. On the main front page, individual posts, archive page, etc, my right sidebar displays correctly; however, on Pages the sidebar is underneath the content. Here’s what I mean:
http://www.nerdoverload.com/ (Looks fine)
and
http://www.nerdoverload.com/editorial-policy/ (Under Content)
I’ve gathered that the problem is somewhere in either the pages.php or loop-page.php file, but for the life of me I can’t seem to figure it out. Here’s the code:
loop-page.php
<?php /** * The loop that displays a page. * * The loop displays the posts and the post content. See * http://codex.wordpress.org/The_Loop to understand it and * http://codex.wordpress.org/Template_Tags to understand * the tags used in it. * * This can be overridden in child themes with loop-page.php. * * @package WordPress * @subpackage Twenty_Ten * @since Twenty Ten 1.2 */ ?> <?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?> <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>> <?php if ( is_front_page() ) { ?> <h2 class="entry-title"><?php the_title(); ?></h2> <?php } else { ?> <h1 class="entry-title"><?php the_title(); ?></h1> <?php } ?> <div class="entry-content"> <?php the_content(); ?> <?php wp_link_pages( array( 'before' => '<div class="page-link">' . __( 'Pages:', 'twentyten' ), 'after' => '</div>' ) ); ?> <?php edit_post_link( __( 'Edit', 'twentyten' ), '<span class="edit-link">', '</span>' ); ?> </div><!-- .entry-content --> </div><!-- #post-## --> <?php comments_template( '', true ); ?> <?php endwhile; // end of the loop. ?>
page.php
<?php /** * The template for displaying all pages. * * This is the template that displays all pages by default. * Please note that this is the WordPress construct of pages * and that other 'pages' on your WordPress site will use a * different template. * * @package WordPress * @subpackage Twenty_Ten * @since Twenty Ten 1.0 */ get_header(); ?> <div id="container"> <div id="content" role="main"> <?php /* Run the loop to output the post. * If you want to overload this in a child theme then include a file * called loop-single.php and that will be used instead. */ get_template_part( 'loop', 'page' ); ?> </div><!-- #content --> </div><!-- #container --> <?php get_sidebar(); ?> <?php get_footer(); ?>
If anyone can help me out with this It’d be GREATLY appreciated! Thanks!
-
Your are missing closing </div> tag for your #main Div element.
In your page.php file, add:
</div><!-- #main -->
Below:
</div><!-- #content --> </div><!-- #container -->
So it looks like:
</div><!-- #content --> </div><!-- #container --> </div><!-- #main -->
That did the trick! I knew it would be something small like that. Thanks a bunch!
- The topic ‘Sidebar Appears Under Content On Pages, Works On Main/Posts?’ is closed to new replies.