douyudouchao6779 2016-05-23 09:46
浏览 63

WooCommerce自定义单页

I am trying to build out a custom view for single product pages within WooCommerce. If a product say lives in a category called 'custom' I want WooCommerce to detect this by switching to a custom page layout if the product lives in that category.

I have tried to do this by adding the following code to single-product.php

    if (is_product_category( 'custom')) {
        wc_get_template_part( 'content', 'single-product-custom' );
    } else {
        wc_get_template_part( 'content', 'single-product' );
    }   

I have created a category called 'custom' and also created a template called 'conent-single-product-custom.php'but I get an error if I place an item in the custom category which is the following:

Warning: include(/home/website/public_html/wp-content/themes/theme/woocommerce/single-product-custom.php): failed to open stream: No such file or directory in /home/website/public_html/wp-includes/template-loader.php on line 89

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 树莓派与pix飞控通信
    • ¥15 自动转发微信群信息到另外一个微信群
    • ¥15 outlook无法配置成功
    • ¥30 这是哪个作者做的宝宝起名网站
    • ¥60 版本过低apk如何修改可以兼容新的安卓系统
    • ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏
    • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
    • ¥50 有数据,怎么用matlab求全要素生产率
    • ¥15 TI的insta-spin例程
    • ¥15 完成下列问题完成下列问题