Results 1 to 1 of 1

Thread: How to Add Another Sidebar

  1. #1
    Former lead dev Nick's Avatar
    Join Date
    Jun 2009
    Location
    Kakamigahara, Japan
    Posts
    2,859
    Blog Entries
    88
    Thanks
    483
    Thanked 808 Times in 527 Posts

    Default How to Add Another Sidebar

    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 Code:
    <?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:

    PHP Code:
    $h->displayTemplate('sidebar'); 
    The name in the parenthesis should match the file name of your sidebar templates (without the .php extension), e.g.

    PHP Code:
    $h->displayTemplate('sidebar_left');
    $h->displayTemplate('sidebar_right'); 


    Note:
    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 by Nick; 01-06-2010 at 02:21 PM.

  2. Thanked by:


Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •