• Using a theme (based on Sandbox) i created 6 sidebars in widgets. I did this by modifying the line in functions.php to read

    register_sidebars(6, $p);

    So then I created a new template by copying the default page template an renaming it.

    I assume to point to the sidebar #3 in the new template I need to modify the line:
    <?php get_sidebar() ?>

    Somewhere I read that to place Sidebar 3 in the template you use the code:

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

    But this doesn’t work. Any ideas what I am doing wrong?

Viewing 3 replies - 1 through 3 (of 3 total)
  • So then I created a new template by copying the default page template an renaming it.

    Did you following the instructions in the Codex on creating custom page templates?

    Plus, if you want 6 different sidebars, you’ll either need 6 different sidebar files which you can call independently (e.g. get_sidebar(‘three’) would call the file sidebar-three.php). Or you’ll need to use conditionals in your main sidebar template to define when each widget-block should be loaded.

    Thread Starter TSemmes

    (@tsemmes)

    Thanks for your response.

    I did follow the instructions in the Codex for creating a new page template.
    I didn’t know that you had to create different sidebar file for each side bar widget. When I go to the widgets panel I see that I have 6 available sidebar widgets. What do I need to create the sidebar file?

    what I am trying to do is use WordPress as a CMS for a small site. So the sidebars would be different on each page and the header would change as well. I find plenty of tutorials but none that gives the complete steps so I am trying to fit different tutorials together but each has a slightly different coding.

    Have a look at http://codex.wordpress.org/WordPress_Widgets_Api/register_sidebars
    That will give you some idea of how you can set sidebars up.

    http://codex.wordpress.org/Function_Reference/get_sidebar
    explains how to call different sidebar files based on the current page.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Adding widget sidebar to new page template’ is closed to new replies.