Home / Forums / DynamiX Support / Calling widget sidebars

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author

  • Loan Hammer


    1) How do I specify the ID of a widget sidebar

    2) How do I specify the path to the widget sidebar

    I am trying to call different widget sidebars for different category archives. I have everything to where the different categories go to their own archive template, and I can see where to put the call for the sidebar, but I can't figure out what to name the sidebar to call it properly.

    I looked at the documentation in the widgets.php file where it states the naming convention:

     * The default for the name is "Sidebar #", with '#' being replaced with the

     * number the sidebar is currently when greater than one. If first sidebar, the

     * name will be just "Sidebar". The default for id is "sidebar-" followed by the

     * number the sidebar creation is currently at. If the id is provided, and multiple

     * sidebars are being defined, the id will have "-2" appended, and so on.

    I tried putting in the following and could not get it to call any widget sidebars.

    <?php get_sidebar('-2'); ?>

    <?php get_sidebar('sidebar-2'); ?>

    <?php get_sidebar(-2); ?>

    I can create my own sidebar and place it in the root of the theme and call it just fine: sidebar-fitness.php with <?php get_sidebar('fitness'); ?>, but then I drop all the functionality of the widgets and core styling of the theme.

    I have 5 sidebars created in the widget area.

    Can anyone help with this?


    First off, the theme calls get_sidebar() to include the sidebar.php file. Within sidebar.php it calls dynamic_sidebar() which then includes the widgetized areas.

    If you're looking to include different widetized areas per category then you'll need to copy sidebar.php to your child theme and add some code to it.

    For instance, if I have a category named contests and I want to include sidebar3 then here is what I would add to sidebar.php

    if(is_category('contests') || in_category('contests')) {$DYN_sidebar_one_select="sidebar3";}

    This would go right before this


    /* Call Custom Page Variables *END*     */



    Should also mention that this will override any other settings on a per post basis as well, if it's in the contests category.

    If you want that functionality back you can remove || in_category('contests')

    Loan Hammer

    Works perfect! Interesting that other threads similar to this one were answered with "you can't have category specific sidebars" when the solution is quick and painless like this.

    Much appreciated.

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.