关于WordPress儿童主题路径

问题描述 投票:0回答:1

我有一个关于wordpress儿童主题的问题。

我试图修改子主题中的wc-template-hooks.php。

文件的路径如下。

/wp-content/plugins/woocommerce/includes/wc-template-hooks.php

我将此文件复制到子主题路径,但不适用。

/wp-content/themes/(child-theme)/wc-template-hooks.php
or
/wp-content/themes/(child-theme)/includes/wc-template-hooks.php
wordpress
1个回答
0
投票

您可以覆盖WooCommece中的模板文件夹,例如:要覆盖管理订单通知,请复制:wp-content / plugins / woocommerce / templates / emails / admin-new-order.php到wp-content / themes / yourtheme / woocommerce /电子邮件/管理 - 新order.php

如果你想修改钩子,你可以使用即

// Remove functions from woocommerce_after_shop_loop_item_title hook with original priority
remove_action( 'woocommerce_after_shop_loop_item_title', 'woocommerce_template_loop_rating', 5 );
remove_action( 'woocommerce_after_shop_loop_item_title', 'woocommerce_template_loop_price', 10 );
// Added functions to woocommerce_after_shop_loop_item_title hook with new priority
add_action( 'woocommerce_after_shop_loop_item_title', 'woocommerce_template_loop_rating', 10 );
add_action( 'woocommerce_after_shop_loop_item_title', 'woocommerce_template_loop_price', 5 );
© www.soinside.com 2019 - 2024. All rights reserved.