我只在 woocommerce 单品页面上显示我的第二个右侧边栏时遇到问题。它根本不会显示出来。以下是我所做的。有什么问题或我错过了什么?
我将此添加到我的 woocommerce 页面,single-product.php 文件
<?php
/**
* woocommerce_sidebar hook
*
* @hooked woocommerce_get_sidebar - 10
*/
/* do_action('woocommerce_sidebar'); */
include("sidebar5.php");
?>
我已将侧边栏添加到我的 wp-content > 主题 > 主题 > 包含 > sidebars.php 文件中。它已经有 4 个侧边栏(一个右侧和三个页脚):
register_sidebar( array(
'name' => 'Sidebar Woo',
'id' => 'sidebar-5',
'before_widget' => '<div id="%1$s" class="widget %2$s">',
'after_widget' => '</div> <!-- end .widget -->',
'before_title' => '<h4 class="widgettitle">',
'after_title' => '</h4>',
) );
我创建了一个 sidebar5.php 页面:
<?php if ( is_active_sidebar( 'sidebar-5' ) ){ ?>
<div id="sidebar">
<?php dynamic_sidebar( 'sidebar-5' ); ?>
</div> <!-- end #sidebar -->
<?php } ?>