• Please tell me how to have a main sidebar, but use another sidebar with different widgets for my blog page. Thanks!!

Viewing 8 replies - 1 through 8 (of 8 total)
  • You would need to create 1 or more new, widget-ready, sidebar template files. Then, assuming you’re using a static front page, use get_sidebar to call one of them in your front page’s template file and another in your index.php file for your blog page.

    Thread Starter leighangela

    (@leighangela)

    Are there steps detailing what you’re telling me to do? I appreciate you saying “create a new sidebar template file,” but how?

    thanks.

    You need to examine your current theme’s sidebar.php template file and use that as a foundation for your new sidebar. It helps if you’re comfortable using PHP, XHTML and WordPress tags but you could start by simply copying your current sidebar.php file and saving the copy as sidebar-alt.php.

    Then it will be a case of removing what you don’t want from the new file and adding in the bits that you do want – which can be done on a step by step basis.

    Thread Starter leighangela

    (@leighangela)

    I see! So, does this mean the widgets in the alternate sidebar won’t have the simple drag and drop ability of the original sidebar? Or will the alternate sidebar show up on the widgets page too?

    thanks a lot.

    If you want the the new sidebar to be widget-capable, it will mean tweaking some the copied code in your new sidebar and making a small addition to your theme’s functions.php file. The new sidebar will then accept widgets completely independently from your current sidebar.

    Thread Starter leighangela

    (@leighangela)

    I see. Do you happen to know the specifics? I appreciate your help.

    The specifics vary with every single theme.

    Hi:

    Basically Sidebar Widgets are inserted through the following method that can be found in the theme’s template files.
    dynamic_sidebar( 'secondary-widget-area' );
    Where the value passed is the name of the sidebar.

    To be able to use the WordPress Widget Admin to drag-n-drop widgets to your named sidebars you will need to register them in your theme’s functions.php file.

    Example:

    register_sidebar(
        array(
            'name' => __( 'Secondary Widget Area', 'twentyten' ),
            'id' => 'secondary-widget-area',
            'description' => __( 'The secondary widget area', 'twentyten'
        ),
        'before_widget' => '<li id="%1$s" class="widget-container %2$s">',
        'after_widget' => '</li>',
        'before_title' => '<h3 class="widget-title">',
        'after_title' => '</h3>',
     ) );

    You should be able to search the functions file and copy the existing registration and change the name to your newly created one and you should be all set.

    Hope this helps you out.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘How to have different sidebars on different pages?’ is closed to new replies.