WooCommerce在产品类别页面上没有侧边栏
如果您比较了商店页面,我将构建
https://inflite.cc/typeone/shop/
和类别页
您可以看到WordPress类别页面没有侧边栏。这似乎不是我可以在存档 /类别页面上看到的主题选项设置,因此我想知道是否还有另一种方法可以在使用functions.php中添加此方法,或者可能将哪个PHP主题文件用于存档页面?
文件具有以下内容
<?php
/**
* woocommerce_sidebar hook.
*
* @hooked woocommerce_get_sidebar - 10
*/
do_action( 'woocommerce_sidebar' );
?>
该
“ Archive-product.php”的文件,
我注意到一个名为
<?php
if ( (! function_exists( 'cs_framework_init' ) && is_active_sidebar('shop_sidebar')) || (is_shop() && cs_get_option('enable_sidebar_ecommerce')) || is_product() && cs_get_option('enable_sidebar_ecommerce_detail')) { ?>
<div class="col-md-3">
<?php if ( ! function_exists( 'dynamic_sidebar' ) || ! dynamic_sidebar( 'shop_sidebar' ) ); ?>
</div>
<?php }
?>
If you compare a shop page I'm building
https://inflite.cc/typeone/shop/
and the category page
https://inflite.cc/typeone/product-category/accessories/
you can see that the wordpress categories pages has no sidebars. This doesn't appear to be a theme options setting that I can see for archive / category pages so I wondered if there was another way to add this in using functions.php or which php theme file would likely be used for archive pages?
I notice a file called "archive-product.php" which has the following
<?php
/**
* woocommerce_sidebar hook.
*
* @hooked woocommerce_get_sidebar - 10
*/
do_action( 'woocommerce_sidebar' );
?>
but this isn't injecting the sidebar onto my product-category pages
Thanks
sidebar.php
<?php
if ( (! function_exists( 'cs_framework_init' ) && is_active_sidebar('shop_sidebar')) || (is_shop() && cs_get_option('enable_sidebar_ecommerce')) || is_product() && cs_get_option('enable_sidebar_ecommerce_detail')) { ?>
<div class="col-md-3">
<?php if ( ! function_exists( 'dynamic_sidebar' ) || ! dynamic_sidebar( 'shop_sidebar' ) ); ?>
</div>
<?php }
?>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论