Wordpress 自定义Gutenberg编辑器生成的woocommerce产品循环模板
我想在woocommerce的产品循环中显示一些自定义的post meta My函数在默认商店页面中显示的循环中工作 但是,当产品循环是通过编辑页面/Gutenberg编辑器的快捷代码生成时,它不起作用Wordpress 自定义Gutenberg编辑器生成的woocommerce产品循环模板,wordpress,woocommerce,shortcode,wordpress-gutenberg,storefront,Wordpress,Woocommerce,Shortcode,Wordpress Gutenberg,Storefront,我想在woocommerce的产品循环中显示一些自定义的post meta My函数在默认商店页面中显示的循环中工作 但是,当产品循环是通过编辑页面/Gutenberg编辑器的快捷代码生成时,它不起作用 add_action( 'woocommerce_after_shop_loop_item', 'free_tag', 0); function free_tag(){ global $product; if( $product->get_price() == 0){
add_action( 'woocommerce_after_shop_loop_item', 'free_tag', 0);
function free_tag(){
global $product;
if( $product->get_price() == 0){
remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart');
}else{
add_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart');}
};
}
有问题的代码是(在Gutenberg编辑器中查看代码时):
上面的代码将返回一个产品循环,但我想添加一些内容来显示循环中每个产品的post meta。但是我不知道如何访问它的模板
例如,下面的remove\u操作
确实适用于Shop页面中的默认循环,但它不会影响Gutenberg Editor生成的循环
add_action( 'woocommerce_after_shop_loop_item', 'free_tag', 0);
function free_tag(){
global $product;
if( $product->get_price() == 0){
remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart');
}else{
add_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart');}
};
}
商店页面中的循环正在使用…plugins\woocommerce\templates
中的content-product.php
,但是编辑content-product.php
不会影响古腾堡编辑器生成的循环
add_action( 'woocommerce_after_shop_loop_item', 'free_tag', 0);
function free_tag(){
global $product;
if( $product->get_price() == 0){
remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart');
}else{
add_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart');}
};
}
哪里可以找到Gutenberg编辑器中woocommerce生成的循环的钩子和模板