php - 难以在 wordpress single.php 中显示动态侧边栏
问题描述
我试图在我的 single.php 中显示侧边栏小部件但我不确定发生了什么。它在页面加载时显示并消失,然后显示数字“1”而不是小部件形式。
这是function.php中的代码
function wpb_widgets_init() {
register_sidebar( array(
'name' => __( 'Subscribe form sidebar', 'semplice' ),
'id' => 'newsletter',
'description' => __( 'The subscribe form sidebar appears on the right on each post', 'semplice' ),
'before_widget' => '<aside id="%1$s" class="widget %2$s">',
'after_widget' => '</aside>',
'before_title' => '<h3 class="widget-title">',
'after_title' => '</h3>',
) );
}
add_action( 'widgets_init', 'wpb_widgets_init' );
single.php 中的代码
$output .= '
<div class="container">
<div class="row">
<div class="column" data-xl-width="8" data-md-width="11" data-sm-width="12" data-xs-width="12">
<div class="post-heading">
' . $this->date_comments_link($id, $options, $permalink) . '
<h2><a href="' . $permalink . '">' . get_the_title() . '</a></h2>
</div>
<div class="post-content">
' . $this->get_content($is_single) . '
' . $this->metas($id, $options) . '
</div>
</div>
<div class="column" data-xl-width="4" data-md-width="11" data-sm-width="12" data-xs-width="12">
' . dynamic_sidebar( 'newsletter' ) . '
</div>
</div>
</div>
';
return $output;
}
请有人纠正这里的错误是什么?
提前致谢。
解决方案
推荐阅读
- rsync - rysnc 传输的文件名与源文件名不同
- haproxy - 使用 Haproxy 的漏桶方法 - 速率限制
- sas - 一个 sql 查询创建两个单独的表
- c++ - 函数参数为 __builtin_constant_p?
- selenium - Robot Framework/Selenium 中的“可见”和“点击元素”有区别吗?
- vaadin - 拒绝尚未发布的文件的发布文件请求。尝试了所有选项,但没有奏效
- angular - 从另一个组件调用 ngOnInit() 时不会刷新组件
- webpack - 如何修复流程以查看 package.json “module”而不是“main”
- outlook - Office 加载项无法在带有 Exchange 2016 的 Safari 上运行
- python - 从 2 个数据帧中删除重复项