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!
http://codex.wordpress.org/Function_Reference/get_sidebar
<?php get_sidebar('other'); ?>
for instance will call the template sidebar-other.phpyou would add the
dynamic_sidebar()
code in that sidebar-other.php template;see also http://codex.wordpress.org/Widgetizing_Themes