我已经注册了一个侧边栏,并在我的所有页面上使用它。由于某种原因,定制者无法识别它。
我做错什么了吗?
这是我的代码:
functions.php
function registerSidebar() {
register_sidebar( array(
\'name\' => \'Main sidebar\',
\'id\' => \'main-sidebar\',
\'description\' => \'Main sidebar on the left.\',
\'before_widget\' => \'<div id="%1$s" class="widget flex-column %2$s">\',
\'after_widget\' => \'</div>\',
\'before_title\' => \'<h5 class="widgettitle font-weight-bold">\',
\'after_title\' => \'</h5>\'
) );
}
add_action( \'widgets_init\', \'registerSidebar\' );
sidebar.php
dynamic_sidebar( \'main-sidebar\' );
然后我只在header.php 文件,如下所示:get_sidebar();
这是我收到的信息的图像: