2017-03-01 23 views
0

、私はこのアクションを実行します。編集製品のフックWoocommerce

add_action('woocommerce_template_single_excerpt', 'woocommerce_custom_single_excerpt', 20); 

function woocommerce_custom_single_excerpt() { 
    global $post; 
    echo '<p class="product-description">'; 
    echo $post->post_excerpt; 
    echo '</p>'; 
} 

<?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'); 
?> 

私が欲しいのは私はのfunctions.phpにこのコードを書いたwoocommerce_template_single_excerptを編集することですしかし、それはまったくオーバーライドしません。

ありがとうございました!

答えて

2

このコードスニペットをお試しください。

add_action('woocommerce_single_product_summary', 'woocommerce_custom_single_excerpt', 15); 

function woocommerce_custom_single_excerpt() { 
    global $post; 
    echo '<p class="product-description">'; 
    echo "hello"; 
    echo '</p>'; 
} 
関連する問題