WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Sidebar pushed below content, yet plenty of room (2 posts)

  1. jamminjames
    Member
    Posted 1 year ago #

    I'm trying to add a left sidebar to the home page, using the Max Magazine responsive theme. I created a child theme and made a functions.php file in it, with this:

    <?php
    add_action( 'widgets_init', 'child_register_sidebar' );

    function child_register_sidebar(){
    register_sidebar(array(
    'name' => 'Sidebar 3',
    'id' => 'sidebar-3',
    'before_widget' => '<div id="%1$s" class="widget %2$s">',
    'after_widget' => '</div>',
    'before_title' => '<h4 class="widgettitle">',
    'after_title' => '</h4>',
    ));
    }

    ?>

    I created a child style.css file as well, and adjusted the dimensions of the container to 1060 to allow room for an extra column. I shrank the #content to 580px and reduced the original sidebar as well. I changed the #content from float: left to float: none and a left margin of 170 to allow room for the left sidebar. The widths of the sidebars and content, with margins and padding, add up to less than the 1060 width of the container.

    I added this to the index.php file, above the <div id="content"> section:

    <aside id="sidebar-3">
    <?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('sidebar-3') ) ?>
    </aside>

    So, the left sidebar I created is showing correctly, not pushed down. However, the right (original) sidebar is being pushed down below the content, even though there is plenty of room for it in the container.

    Please help. Thanks!

    The site is here: http://raftwet.com/wordpress_35564220/wordpress/

  2. jamminjames
    Member
    Posted 1 year ago #

    Ok, foolish me. I just had to use <div>s around both sidebars, before and after the <div> for content.

Topic Closed

This topic has been closed to new replies.

About this Topic