1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

[Docs] How to Add Another Sidebar

Discussion in 'Design and Layout' started by Nick, Aug 8, 2009.

  1. Nick

    Nick Well-Known Member

    Note: In this tutorial, a "sidebar" is really just a widget block and can be used anywhere, not only in sidebars, e.g. in the footer. A "widget block" can hold as many widgets as you like.

    1. Create additional sidebar templates

    To add another sidebar to your theme, create a copy (or multiple copies of sidebar.php and rename them to anything you like, e.g. change the original to sidebar_left.php and the copy to sidebar_right.php.

    2. Add the widget block plugin hook in each template:

    In each file, make sure you have this plugin hook:

    <?php $h->pluginHook('widget_block''', array(1)); ?>
    The number in the array is an ID number for this widget_block, so you'll need to change the next one to 2.

    3. Include the new templates from index.php

    In your theme's index.php file, you should be able to see this:

    The name in the parenthesis should match the file name of your sidebar templates (without the .php extension), e.g.


    Index.php in the default theme has a plugin hook wrapped around the displayTemplate line. For now, just leave that and add your new displayTemplate line anywhere on the page.

    4. Install the Widgets plugin

    Go to Admin -> Plugin Management and install the Widgets plugin. This will be used to manage your widgets.

    5. Manage your widgets

    Go to Admin -> Widgets (under Plugin Settings). You should see one widget block listed containing any widgets provided by plugins, e.g. Categories. To move those into your second sidebar, just click the down arrow for the last widget listed and you should see Widget Block 2 appear with that widget now in it.

    6. View your site

    When you return to your main site, you should see any moved widgets appear in your new sidebar. If not, review the steps above and let us know in the Plugins forum if you need any assistance.
    Last edited: Jan 6, 2010
    hangbowl likes this.

Share This Page