Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/wordpress/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Wordpress 自定义Gutenberg编辑器生成的woocommerce产品循环模板_Wordpress_Woocommerce_Shortcode_Wordpress Gutenberg_Storefront - Fatal编程技术网

Wordpress 自定义Gutenberg编辑器生成的woocommerce产品循环模板

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){

我想在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){
        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生成的循环的钩子和模板