[resolved] Adding Multiple Sidebars to Studio Theme (2 posts)

  1. kate3686
    Posted 4 years ago #

    I am in the process of adding multiple sidebars to the Studio Theme and I'm running into an issue, which is really due to my ignorance of PHP. OK...this is what I want to do. I want to be able to choose different page templates under Pages, and those templates each call a different sidebar.

    Here's what I've done: I've added two new sidebars to the array and I can see them under Widgets. I've also added two new page templates, which I am able to select for my pages. All is well there, BUT...

    I cannot get the templates to load the correct sidebars. I'm 100% sure that I'm just not writing the code correctly. I'm sure I'm putting in the right file. I've tried writing it different ways and no luck. This is what I have:

    <?php if(is_page_template('page-sidebar1.php')) get_sidebar('secondary_sidebar1');
    elseif(is_page_template('page-sidebar2.php')) get_sidebar('secondary_sidebar2');
    elseif(is_page_template('page-fullwidth.php') ;
    else get_sidebar('main_sidebar');

    So I want sidebar1 and sidebar 2 to load with the matching page templates. I want the fullwidth template to NOT load a sidebar. And I want any other page template to load the main sidebar.

    Please, please help!! Thanks in advance!

  2. kate3686
    Posted 4 years ago #

    **Double posted - sorry... closing this post.

Topic Closed

This topic has been closed to new replies.

About this Topic