我已经开始学习如何使用 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' );
?>
例如,当我想编辑它(删除一些字段并更改结构)时,我尝试擦除字符串:
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 - 30
* @hooked woocommerce_template_single_meta - 40
* @hooked woocommerce_template_single_sharing - 50
*/
//do_action( 'woocommerce_single_product_summary' );
do_action('woocommerce_template_single_title');
?>
你能告诉我为什么这不起作用吗?
这样编辑的正确方法是什么?
谢谢