Php 动态侧边栏未显示在页面上

Php 动态侧边栏未显示在页面上,php,wordpress,function,Php,Wordpress,Function,我试图通过将此代码添加到主题的Functions.php来添加侧栏 if(function_exists('register_sidebar')) { register_sidebar(array( 'name' => __('Company Single Sidebar', 'responsive'), 'description' => __('Area 12 - company-singlesidebar.php', 'responsive'),

我试图通过将此代码添加到主题的Functions.php来添加侧栏

if(function_exists('register_sidebar')) {
 register_sidebar(array(
        'name' => __('Company Single Sidebar', 'responsive'),
        'description' => __('Area 12 - company-singlesidebar.php', 'responsive'),
        'id' => 'company-singlesidebar',
        'before_title' => '<div class="widget-title">',
        'after_title' => '</div>',
        'before_widget' => '<div id="%1$s" class="%2$s">',
        'after_widget' => '</div>'
    ));
}
if(函数_存在('register_边栏')){
寄存器侧栏(数组)(
“名称”=>“(“公司单侧栏”,“响应”),
“description'=>”(第12区-company singlesidebar.php,“responsible”),
'id'=>'company singlesidebar',
“在标题“=>”之前,
“在标题“=>”之后,
'在小部件'=>''之前,
'在小部件'=>''之后
));
}
然后,我将此代码添加到模板页面

        <div class="contant_right_wrap">
          <?php dynamic_sidebar('company-singlesidebar');?>
        </div>

侧边栏显示在小部件中,但不显示在页面上。

这里有一些提示:

  • 如果(function_exists())条件语句,则无需将侧栏注册包装在
    中<代码>寄存器\侧栏是一个核心功能,因此它将始终存在

  • 注册边栏时,最好在函数内部注册边栏,然后将该函数挂接到
    widgets\u init
    hook


除此之外,您的代码应该可以工作

您是否在后端的侧栏中添加了一个小部件是的,我在侧栏中添加了两个文本小部件。我们必须为这个侧边栏创建新的PHP页面@彼得·古森诺。您是否检查过您的页面以验证它是否确实存在,是否可能被cssAny在该问题上的进展所隐藏?