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 delta降尺度计算的一些细节,有偿
    • ¥15 Arduino红外遥控代码有问题
    • ¥15 数值计算离散正交多项式
    • ¥30 数值计算均差系数编程
    • ¥15 redis-full-check比较 两个集群的数据出错
    • ¥15 Matlab编程问题
    • ¥15 训练的多模态特征融合模型准确度很低怎么办
    • ¥15 kylin启动报错log4j类冲突
    • ¥15 超声波模块测距控制点灯,灯的闪烁很不稳定,经过调试发现测的距离偏大
    • ¥15 import arcpy出现importing _arcgisscripting 找不到相关程序