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 如何在scanpy上做差异基因和通路富集?
    • ¥20 关于#硬件工程#的问题,请各位专家解答!
    • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
    • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
    • ¥30 截图中的mathematics程序转换成matlab
    • ¥15 动力学代码报错,维度不匹配
    • ¥15 Power query添加列问题
    • ¥50 Kubernetes&Fission&Eleasticsearch
    • ¥15 報錯:Person is not mapped,如何解決?
    • ¥15 c++头文件不能识别CDialog