WooCommerce在产品类别页面上没有侧边栏

发布于 2025-02-13 17:46:27 字数 1248 浏览 1 评论 0原文

如果您比较了商店页面,我将构建

https://inflite.cc/typeone/shop/

和类别页

https://inflite.cc/typeone/productcemate/product-category/accategory/accessory/accessory/accessory/accessory/

您可以看到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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文