WordPress.org

Support

Support » Themes and Templates » Multiple siderbars not loading correctly

Multiple siderbars not loading correctly

  • I am trying to create a separate widgitized sidebar to be displayed on my pages. I am utilizing theme constructor 0.8.1.

    Basically the problem that I am experiencing is getting the additional sidebar to locate it’s self in the correct location.

    I found this support ticket (http://wordpress.org/support/topic/111551?replies=20#post-537055) that allowed me to edit my functions.php file and that works correctly. Like this;

    if ( function_exists('register_sidebar') ) {
        register_sidebar(array('name'=>'sidebar',
            'before_widget' => '<li id="%1$s" class="widget %2$s">',
            'after_widget' => '</li>',
            'before_title' => '<h3 class="widgettitle">',
            'after_title' => '</h3>',
        ));
        register_sidebar(array('name'=>'front',
            'before_widget' => '<li id="%1$s" class="widget %2$s">',
            'after_widget' => '</li>',
            'before_title' => '<h3 class="widgettitle">',
            'after_title' => '</h3>',
        ));
    }

    I created my additional sidebar-front.php file and added the necessary code as shown in the ticket.

    <?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('front') ) : ?>
    <?php endif; ?>

    So where my troubles are is with the necessary code to be place on my page template file (template-front.php) which is copied from the original template files. I used the following codex page information (http://codex.wordpress.org/Customizing_Your_Sidebar).

    I first tried this code;
    <?php get_sidebar('front'); ?>
    Nothing happened. The page was still referencing the default sidebar.

    Then I tried this code;
    <?php include ('sidebar-front.php'); ?>
    Now this code brings in the correct sidebar, however the location is wrong. Instead of in the right hand column, it ends up at the bottom of the page just about the footer on the far left.

    So then I tried the following code;

    <?php if ( !function_exists('dynamic_sidebar')
    || !dynamic_sidebar('front') ) : ?>
    <?php endif; ?>

    Same thing happened as the “include” command.

    What is a little different with this theme is the get_sidebar commend is slightly different.
    <?php get_constructor_sidebar('front'); ?>
    Now I am unsure of why the _constructor is in there. But if you remove it, the sidebar does not show up at all, and just adding ‘front’ does not call up my alternate sidebar.

    So if anyone has any incites, in how can get this to work, it would be greatly appreciated.

Viewing 7 replies - 1 through 7 (of 7 total)
  • since you’re registering two sidebars, you need to modify the code in your functions folder to

    if ( function_exists('register_sidebars') )
    	register_sidebar(array('name'=>'Sidebar Top',));
    	register_sidebar(array('name'=>'Sidebar Bottom Left',));
    	register_sidebar(array('name'=>'Sidebar Bottom Right',));

    Then to call in the sidebars the following:

    <?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('Sidebar Top') ) : ?>

    in other words, add the letter “S” to trigger the 2nd sidebar.

    This theme already has multiple sidebars in it, such as the left and right column, footer, header etc. I don’t see how adding the “S” helps. Anyways I have the functions.php set up correctly. It is calling the sidebars into the template file that is not working correctly and I have already tried the code you posted which did not work.

    esmi

    @esmi

    Forum Moderator

    Sounds like you’re using a Constructor theme – in which case you’ll need to locate and examine the get_constructor_sidebar() function within the theme’s files.

    I am using a constructor theme. Any idea where I would look? Would it be the style sheet or the css file?

    esmi

    @esmi

    Forum Moderator

    It will be within a .php file.

    <?php get_constructor_sidebar(‘front’); ?>

    “constructor_sidebar.php” is the name of a file. Sounds like a css problem.

    my side bars load properly when you click on each post, but not when you click on Home, or when the site first comes up.

    What do I need to do?

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Multiple siderbars not loading correctly’ is closed to new replies.