我似乎不太明白它是怎么工作的。
默认情况下,我在侧栏中有一个侧栏。我使用加载的phpget_sidebar();
. 这很好(无需注册),但我有一个自定义页面模板,用于另一个页面,我想加载另一个侧栏。我知道我可以使用include(\'filename\')来加载它,但我假设也有某种wordpress方法来加载它。
我知道我必须在函数中注册新的侧栏。php文件,但我实际上在哪里引用侧栏文件?
从文档:
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").
在这两个首选项中,您都没有指定侧栏的文件名,那么我该怎么做呢?
成功注册后,我假设可以使用get_sidebar(ID);
, 这样行吗?
非常感谢您的帮助!