Php 在“产品数据”选项卡中自定义评论说明

Php 在“产品数据”选项卡中自定义评论说明,php,wordpress,woocommerce,hook-woocommerce,Php,Wordpress,Woocommerce,Hook Woocommerce,我想更改“审阅产品数据”选项卡中的默认文本 我尝试了以下代码,它适用于描述,但现在只有新的描述,没有显示其他内容。 没有评论、明星或留下新评论的选项 add_filter( 'woocommerce_product_tabs', 'woo_custom_description_tab', 98 ); function woo_custom_description_tab( $tabs ) { $tabs['reviews']['callback'] = 'woo_custom_d

我想更改“审阅产品数据”选项卡中的默认文本

我尝试了以下代码,它适用于描述,但现在只有新的描述,没有显示其他内容。 没有评论、明星或留下新评论的选项

add_filter( 'woocommerce_product_tabs', 'woo_custom_description_tab', 98 ); 
function woo_custom_description_tab( $tabs ) { 


    $tabs['reviews']['callback'] = 'woo_custom_description_tab_content';    // Custom reviews callback 

    return $tabs; 
} 


function woo_custom_description_tab_content() { 
    echo '<h2>Custom Description</h2>'; 
    echo '<p>Here\'s a custom description</p>'; 
} 
add_filter('woocommerce_product_tabs','woo_custom_description_tab',98);
函数woo_自定义_说明_选项卡($tabs){
$tabs['reviews']['callback']='woo_custom_description_tab_content';//custom reviews callback
返回$tabs;
} 
函数woo_自定义_描述_选项卡_内容(){
回声“自定义描述”;
echo'这里有一个自定义描述

; }
有人能帮我解决吗


谢谢

我找到了一个解决方案:

复制/wp content/plugins/woocommerce/templates/single-product-reviews.php

转到子主题文件夹并编辑注释表单数组

我在之前添加了关键注释注释和自定义描述:

'注释\u注释\u在'=>'自定义文本在此处'

    $comment_form = array(
                    'title_reply'          => have_comments() ? __( 'Add a review', 'woocommerce' ) : sprintf( __( 'Be the first to review &ldquo;%s&rdquo;', 'woocommerce' ), get_the_title() ),
                    'title_reply_to'       => __( 'Leave a Reply to %s', 'woocommerce' ),
                    'comment_notes_after'  => '',
                    'comment_notes_before' => 'CUSTOM TEXT GOES HERE',
                    'fields'               => array(
                        'author' => '<p class="comment-form-author">' . '<label for="author">' . __( 'Name', 'woocommerce' ) . ' <span class="required">*</span></label> ' .
                                    '<input id="author" name="author" type="text" value="' . esc_attr( $commenter['comment_author'] ) . '" size="30" aria-required="true" required /></p>',
                        'email'  => '<p class="comment-form-email"><label for="email">' . __( 'Email', 'woocommerce' ) . ' <span class="required">*</span></label> ' .
                                    '<input id="email" name="email" type="email" value="' . esc_attr(  $commenter['comment_author_email'] ) . '" size="30" aria-required="true" required /></p>',
                    ),
                    'label_submit'  => __( 'Submit', 'woocommerce' ),
                    'logged_in_as'  => '',
                    'comment_field' => ''
                );
$comment\u form=array(
“title\u reply'=>有评论()?”(“添加评论”,“woocommerce”):sprintf(“‘第一个审查&ldquo;%s&rdquo;,‘woocommerce’”),获取标题()),
'title_reply_to'=>'('Leave a reply to%s','woocommerce'),
'注释在'=>''之后,
'注释\u注释\u在'=>'自定义文本在此处',
“字段”=>数组(
“author'=>”

“.”.uuu('Name','woocommerce').*”。 “

”, “email'=>”

。“('email','woocommerce').*”。 “

”, ), “label_submit”=>(“submit”、“woocommerce”), '登录为'=>'', '注释字段'=>'' );