我已经开始学习如何使用WooCommerce创建模板,我遇到了一个小问题.例如,在Woocommerce插件的php文件content-single-product.php中,我有这样的字符串:
<?php
/**
* woocommerce_single_product_summary hook.
*
* @hooked woocommerce_template_single_title - 5
* @hooked woocommerce_template_single_rating - 10
* @hooked woocommerce_template_single_price - 10
* @hooked woocommerce_template_single_excerpt - 20
* @hooked woocommerce_template_single_add_to_cart - 30
* @hooked woocommerce_template_single_meta - 40
* @hooked woocommerce_template_single_sharing - 50
*/
do_action( 'woocommerce_single_product_summary' );
?>
Run Code Online (Sandbox Code Playgroud)
例如,当我想编辑它(删除一些字段并更改结构)时,我尝试删除字符串:
do_action('woocommerce_single_product_summary');
之后写这样:
<?php
/**
* woocommerce_single_product_summary hook.
*
* @hooked woocommerce_template_single_title - 5
* @hooked woocommerce_template_single_rating - 10
* @hooked woocommerce_template_single_price - 10
* @hooked woocommerce_template_single_excerpt - 20
* @hooked woocommerce_template_single_add_to_cart - …Run Code Online (Sandbox Code Playgroud) 我正在使用一个名为Mix 'n Match Products 的基于 Woocommerce 的插件。
此插件位于/plugins/woocommerce-mix-and-match-products/
此文件夹中,其中包含另一个用于模板的文件夹。
按照惯例,我已将“模板”文件夹复制到我的子主题中,并将文件夹名称更改为“ woocommerce-mix-and-match-products ”
现在的结构是 themes/storevilla-child/woocommerce-mix-and-match-products/
但是,没有任何模板会覆盖插件模板。我已经测试过了。只有在我更改了实际的插件模板文件后,HTML 才会更改。
任何人都可以发现我可能做错了什么吗?
谢谢