WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Sidebar appearing below page content (10 posts)

  1. Fred
    Member
    Posted 3 years ago #

    Hi Everyone,

    While making some tweaks, I managed to move my sidebar to below the main page content. From my basic knowledge of html, nothing looks glaringly wrong. Any idea how to get it back along the side like the other pages of my site? I'm comfortable editing the php files or basic WordPress options as long as I have some concrete guidance.

    Any help is greatly appreciated.

    Blog URL: http://blog.tortugabackpacks.com

    Thanks,
    Fred

  2. _ze
    Member
    Posted 3 years ago #

    It looks like you need to move your sidebar and footer code outside of a couple divs. Can you post the page template that is displaying this page? Or, you can simply move the sidebar code down the page, past a couple </div>'s and test it until it's correct. Then just put the footer code below it.

  3. Fred
    Member
    Posted 3 years ago #

    Thanks for replying, _ze. Below is the code from page.php, which has the sidebar code at the bottom already. Not sure how to proceed.

    <?php
    /**
    * @package WordPress
    * @subpackage Tortuga_Theme
    */

    get_header(); ?>
    <div class="narrowcolumn" role="main">
    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    <div class="post" id="post-<?php the_ID(); ?>">
    <h1><?php the_title(); ?></h1>
    <div class="entry">
    <?php the_content('<p class="serif">Read the rest of this page »</p>'); ?>
    <?php wp_link_pages(array('before' => '<p>Pages: ', 'after' => '</p>', 'next_or_number' => 'number')); ?>
    </div>
    </div>
    <?php endwhile; endif; ?>
    <?php edit_post_link('Edit this entry', '<p align="right" class="green">', '</p>'); ?>
    <?php comments_template(); ?>
    </div>
    <?php get_sidebar(); ?>
    <?php get_footer(); ?>

  4. _ze
    Member
    Posted 3 years ago #

    Can you post the content of your header.php, sidebar.php and footer.php files? I can't tell what is causing it from that. Another idea you might want to try first...Your "About Us" page displays correctly. Why don't you make a copy of the page template used by the "About Us" page, and copy and paste the snippets from your index.php (or home.php file if you have one), that is displaying the home page? It might be easier to do that.

  5. Fred
    Member
    Posted 3 years ago #

    Unfortunately, the rest of the site is hosted on Shopify, which breaks up the code into different parts of their admin dashboard, making it difficult to copy into WordPress. Below are the contents of the files you requested. Thanks!

    HEADER.PHP

    <?php
    /**
     * @package WordPress
     * @subpackage Tortuga_Theme
     */
    ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" <?php language_attributes(); ?>>
    <head>
      <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" />
      <title><?php wp_title('«', true, 'right'); ?> <?php bloginfo('name'); ?></title>
      <link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>" type="text/css" media="screen" />
      <link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" />
      <?php if ( is_singular() ) wp_enqueue_script( 'comment-reply' ); ?>
      <?php wp_head(); ?>
    </head>
    <body <?php body_class(); ?>>
      <div id="page">
        <div id="main-menu">
    	 <table cellpadding="0" cellspacing="0" width="100%" border="0" style="margin:30px 0 10px 0;">
    	   <tr>
    		<td width="40%" align="left" valign="bottom" style="text-align: left; vertical-align: bottom;">
    
    		 <ul id="nav-left">
    		   <li ><a href="http://www.tortugabackpacks.com/">Home</a>
    
    <li><a href="http://www.tortugabackpacks.com/products/tortuga-backpack">Shop</a></li>
    <li><a href="http://www.tortugabackpacks.com/pages/benefits">Benefits</a></li>
    <li><a href="http://www.tortugabackpacks.com/pages/faq">FAQ</a></li>
    		 </td>
    
    		<td align="center" style="text-align: center; vertical-align: middle;"><div id="logo"><a title="Tortuga Backpacks" href="http://www.tortugabackpacks.com/"><img src="http://cdn.shopify.com/s/files/1/0049/1212/assets/logo.gif?1276885380" alt="logo" /></a></div></td>
    		<td width="40%" align="right" valign="bottom" style="text-align: right; vertical-align: bottom;">
    		<div id="cart">
    		  <p class="cart-count">
    <a href="http://www.tortugabackpacks.com/cart">View Cart and Checkout</a>
    
    		  </p>
    		</div>
    		<ul id="nav-right">
    
    		  <li ><a href="http://www.tortugabackpacks.com/pages/about-us">About Us</a>	
    
    <li><a href="http://blog.tortugabackpacks.com">Blog</a></li>
    <li><a href="http://www.tortugabackpacks.com/pages/contact">Contact </a></li>
    		</td>
    	   </tr>
    	   </table>
    	</div>
        <div id="content">

    SIDEBAR.PHP

    <?php
    /**
     * @package WordPress
     * @subpackage Tortuga_Theme
     */
    ?>
    	<div id="sidebar">
        <div class="block navs">
    
    <ul>
            <?php 	/* Widgetized sidebar, if you have the plugin installed. */
                if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar() ) : ?>
    
    <li>
              <?php get_search_form(); ?>
            </li>
            <?php if ( is_404() || is_category() || is_day() || is_month() ||
                  is_year() || is_search() || is_paged() ) {
            ?>
    <li>
            <?php /* If this is a 404 page */ if (is_404()) { ?>
            <?php /* If this is a category archive */ } elseif (is_category()) { ?>
            <p class="notes">You are currently browsing the archives for the <?php single_cat_title(''); ?> category.</p>
            <?php /* If this is a daily archive */ } elseif (is_day()) { ?>
            <p class="notes">You are currently browsing the <a>/"><?php bloginfo('name'); ?></a> blog archives
            for the day <?php the_time('l, F jS, Y'); ?>.</p>
            <?php /* If this is a monthly archive */ } elseif (is_month()) { ?>
            <p class="notes">You are currently browsing the <a>/"><?php bloginfo('name'); ?></a> blog archives
            for <?php the_time('F, Y'); ?>.</p>
            <?php /* If this is a yearly archive */ } elseif (is_year()) { ?>
            <p class="notes">You are currently browsing the <a>/"><?php bloginfo('name'); ?></a> blog archives
            for the year <?php the_time('Y'); ?>.</p>
            <?php /* If this is a search result */ } elseif (is_search()) { ?>
            <p class="notes">You have searched the <a>/"><?php bloginfo('name'); ?></a> blog archives
            for <strong>'<?php the_search_query(); ?>'</strong>. If you are unable to find anything in these search results, you can try one of these links.</p>
            <?php /* If this set is paginated */ } elseif (isset($_GET['paged']) && !empty($_GET['paged'])) { ?>
            <p class="notes">You are currently browsing the <a>/"><?php bloginfo('name'); ?></a> blog archives.</p>
            <?php } ?>
            </li>
          <?php }?>
          </ul>
        </div>
        <div class="block navs">
          <ul role="navigation">
            <?php wp_list_pages('title_li=<h2 style="margin-top: 0;">Pages</h2>' ); ?>
    
    <li><h2>Archives</h2>
    <ul>
              <?php wp_get_archives('type=monthly'); ?>
              </ul>
    </li>
            <?php wp_list_categories('show_count=1&title_li=<h2>Categories</h2>'); ?>
    
    <ul>
            <?php /* If this is the frontpage */ if ( is_home() || is_page() ) { ?>
              <?php wp_list_bookmarks(); ?>
    
    <li><h2>Meta</h2>
    <ul>
                <?php wp_register(); ?>
    
    <li><?php wp_loginout(); ?></li>
    <li><a href="http://validator.w3.org/check/referer" title="This page validates as XHTML 1.0 Transitional">Valid <abbr title="eXtensible HyperText Markup Language">XHTML</abbr></a></li>
    <li><a href="http://gmpg.org/xfn/"><abbr title="XHTML Friends Network">XFN</abbr></a></li>
    <li><a href="http://wordpress.org/" title="Powered by WordPress, state-of-the-art semantic personal publishing platform.">WordPress</a></li>
                <?php wp_meta(); ?>
              </ul>
    </li>
            <?php } ?>
            <?php endif; ?>
          </ul>
        </div>
        <?php include (TEMPLATEPATH . '/sidebar2.php'); ?>
    	</div>

    FOOTER.PHP

    <?php
    /**
     * @package WordPress
     * @subpackage Tortuga_Theme
     */
    ?>
        <div class="clear"></div>
      </div>
      <hr class="hide" />
      <div id="footer">
    
    <ul>
    <li><a href="http://www.tortugabackpacks.com/">Home</a></li>
    <li><a href="http://www.tortugabackpacks.com/products/tortuga-backpack">Shop</a></li>
    <li><a href="http://www.tortugabackpacks.com/pages/benefits">Benefits</a></li>
    <li><a href="http://www.tortugabackpacks.com/pages/faq">FAQ</a></li>
    <li><a href="http://www.tortugabackpacks.com/pages/about-us">About Us</a></li>
    <li><a href="http://blog.tortugabackpacks.com">Blog</a></li>
    <li><a href="http://www.tortugabackpacks.com/pages/contact">Contact</a></li>
          <li class="right"><a href="http://www.tortugabackpacks.com/cart">View Cart and Checkout</a>
        </ul>
        <p><span class="wp-rss"><a>">Entries (RSS)</a> <span class="dash">|</span> <a>">Comments (RSS)</a><!--<?php echo get_num_queries(); ?> queries. <?php timer_stop(1); ?> seconds.--></span> © 2010 <?php bloginfo('name'); ?> is proudly powered by <a href="http://wordpress.org/">WordPress</a>. All rights reserved. <span class="dash">|</span> <a href="#">Terms of Use</a> <span class="dash">|</span> <a href="#">Privacy Policy</a></p>
      </div>
    </div>
    <?php /* "Just what do you think you're doing Dave?" */ ?>
    <?php wp_footer(); ?>
    </body>
    </html>
  6. _ze
    Member
    Posted 3 years ago #

    Honestly, from what you have posted, I can not tell what is causing the sidebar to post below the main content. In my experience, this has always been caused by a misplaced, or missing </div>, or by not clearing a div properly, with (in your case) <div class="clear"></div>.

    I hope that someone else might be able to see what I am missing, or that you will be able to figure it out with some trial and error.

  7. _ze
    Member
    Posted 3 years ago #

    I should add that if you view the source on your blog, and compare it to the templates that you have posted here, it does not match up. When I view the source, I am seeing the sidebar div is contained within
    <div class="narrowcolumn" role="main"> and within the post div, as well.

    Have you tried adding </div> or </div></div> before <?php get_sidebar(); ?>? The problem is that your sidebar and footer are still being contained within the "narrowcolumn" div.

  8. Fred
    Member
    Posted 3 years ago #

    Thanks, _ze. With a better understanding of the code from your replies, I was able to fix the problem. Adding </div> before the get_sidebar function within page.php did not help. However, adding two </div>s before that function in the individual pages (single.php, results.php, etc) fixed the issue. Not sure where the uncleared <div>s were, but, oh well, it's fixed!

    Thanks again for all your help!

  9. _ze
    Member
    Posted 3 years ago #

    I noticed a lot of unnecessary, empty divs looking through your source code. I'm sure it was difficult to find what you were looking for. Sorry I didn't explain it clearer from the beginning. ;)

    Glad you got it fixed, though!

  10. tgkessler
    Member
    Posted 3 years ago #

    Damn!!! After three awful days, finally a fix.

    All I did was add an extra </div> before <?php get_sidebar(); ?> in my single.php and it fixed it.

Topic Closed

This topic has been closed to new replies.

About this Topic