Support » Themes and Templates » I need a different sidebar for different pages, was working, not anymore!

  • Resolved pvalure


    I had multiple sidebars working for another website where I could call in the sidebar in the template as such: <?php get_sidebar(‘about’); ?>

    I know I updated the functions.php file with the different arrays and names, but I feel like I’m missing something. Something big since it’s not working now. Do I need to edit any other files? Did I create another sidebar.php file? I might have had an about-sidebar.php file, but I seriously can’t remember and the multiple sidebar tutorials on the web do not seem to work for me.

    When I edit my functions.php file, the sidebars register and I can place widgets in them, but can’t get the different one to show on different pages. It seems only my default sidebar shows up.

    I place the dynamic_sidebar code in my footer and call in the footer widgetized sidebar and that is the only one that works fine.

    Any suggestions? I’m going nuts.

Viewing 6 replies - 1 through 6 (of 6 total)
  • Nile Flores


    Yoast Support

    The include MUST be to the direct file name.


    <?php include('sidebar2.php'); ?>

    You cannot put just sidebar2 in its place.

    Actually you can use sidebar-name.php
    <?php get_sidebar('name'); ?>

    For a better example…
    <?php get_sidebar('example') ;?>

    Which would look for and call (if it exists) sidebar-example.php

    Same applies for get_header and get_footer..

    I might have gotten closer to the solution I had before. I edited the dynamic sidebars=1 to desired number of sidebars in the widgets.php file. That seemed to work without having to create another sidebar.php file, but something is still off.

    Why not forget about the old method you used before and just use the built in support for sidebar-NAME.php

    You don’t need to do anything other then create the file and the call to the sidebar, eg. get_sidebar('NAME')

    t31os_: I bet that’s exactly what I did! Thanks. Maybe I should call it quits after a certain number of hours, my brain might function better. 🙂

    If u have used the same code in all sidebar(php files) try changing the variable names if there are any.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘I need a different sidebar for different pages, was working, not anymore!’ is closed to new replies.