Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I can't quite seem to figure out how it works.

By default i have a sidebar in sidebar.php that i load using get_sidebar();. That works great (no need to register it), but i have a custom page template for another page where i want to load another sidebar. I know i can use include('filename') to load it but i assume there is some sort of wordpress way to do it as well.

I know i have to register the new sidebar in the functions.php file, but where do i actually reference the sidebar file?

From the doc:

name - Sidebar name (default is localized 'Sidebar' and numeric ID).
id - Sidebar id - Must be all in lowercase, with no spaces (default is a numeric auto-incremented ID).
description - Text description of what/where the sidebar is. Shown on widget management screen. (Since 2.9) (default: empty)
class - CSS class name to assign to the widget HTML (default: empty).
before_widget - HTML to place before every widget(default: '<li id="%1$s" class="widget %2$s">') Note: uses sprintf for variable substitution
after_widget - HTML to place after every widget (default: "</li>\n").
before_title - HTML to place before every title (default: <h2 class="widgettitle">).
after_title - HTML to place after every title (default: "</h2>\n").

In neither of those preferences do you specify the filename of the sidebar, so how do i do it?

After i have registered it successfully, i assume i can load it using get_sidebar(ID);, will that work?

Any help is very appreciated!

share|improve this question

1 Answer 1

up vote 1 down vote accepted

http://codex.wordpress.org/Function_Reference/get_sidebar

<?php get_sidebar('other'); ?> for instance will call the template sidebar-other.php

you would add the dynamic_sidebar() code in that sidebar-other.php template;

see also http://codex.wordpress.org/Widgetizing_Themes

share|improve this answer
    
Oh that was simple. Thank you! –  qwerty Sep 15 '12 at 15:01

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.