我正在用我自己的HTML创建一个自定义主题。我试图覆盖woocommerce模板。我已经创建了一个用woocommerce.php命名的模板,但它仍然显示了带有默认结构的模板。
我检查了系统状态,上面写着Your theme has a woocommerce.php file, you will not be able to override the woocommerce/archive-product.php custom template since woocommerce.php has priority over archive-product.php. This is intended to prevent display issues.
但是,当我加载shop page时,它会以默认结构打开。
一些截图
发布于 2019-01-05 05:49:09
我通过在config.php中禁用Woocommerce模板调试模式来修复这个问题。
define( 'WC_TEMPLATE_DEBUG_MODE', false );您可以检查模板调试模式是否通过以下方式设置:
WP仪表板-> WooCommerce ->系统状态->工具
发布于 2018-11-19 23:20:30
这是一个自定义主题,因此首先您应该检查WooCommerce支持是否在functions.php中声明。
WooCommerce可以通过使用woocommerce_content() (woocommerce.php文件)或模板重写与主题集成,但在这两种情况下都需要在主题中声明支持。
function wpse319485_add_woocommerce_support() {
add_theme_support( 'woocommerce' );
}
add_action( 'after_setup_theme', 'wpse319485_add_woocommerce_support' );https://wordpress.stackexchange.com/questions/319485
复制相似问题