WordPress.org

Ready to get started?Download WordPress

Forums

Multiple siderbars not loading correctly (8 posts)

  1. Symhome
    Member
    Posted 4 years ago #

    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.

  2. Andrew Norcross
    Member
    Posted 4 years ago #

    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.

  3. Symhome
    Member
    Posted 4 years ago #

    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.

  4. esmi
    Forum Moderator
    Posted 4 years ago #

    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.

  5. Symhome
    Member
    Posted 4 years ago #

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

  6. esmi
    Forum Moderator
    Posted 4 years ago #

    It will be within a .php file.

  7. cornetjr
    Member
    Posted 4 years ago #

    <?php get_constructor_sidebar('front'); ?>

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

  8. carolwingert
    Member
    Posted 4 years ago #

    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?

Topic Closed

This topic has been closed to new replies.

About this Topic