如何在评论标题中插入wordpress发布值?

时间:2019-04-21 13:17:26

标签: php wordpress

我正在尝试将wordpress发布值$ offer_title插入评论框标题。标题当前显示为“ Leave Your Review”,但我希望它在“ review”部分之前显示“ $ offer_title”值,例如“ Leave Your XYZ Review”。

这是评论部分的当前代码...

$custom_comment_field = '<textarea id="comment" name="comment" cols="30" rows="10" aria-required="true"></textarea>';
$commenter = wp_get_current_commenter();
            comment_form(array(
                'comment_field'         => $custom_comment_field,
                'comment_notes_after'   => '',
                'logged_in_as'          => '',
                'comment_notes_before'  => '',
                'title_reply'           => __('Leave a Review', 'rehub_framework'),
                'cancel_reply_link'     => __('Cancel reply', 'rehub_framework'),
                'label_submit'          => __('Submit', 'rehub_framework'),
                'fields' => apply_filters( 'comment_form_default_fields', array(

                    'author' =>
                        '<div class="usr_re"><input id="author" type="text" value="' . esc_attr( $commenter['comment_author'] ) .'" name="author" placeholder="'.__('Name', 'rehub_framework').'"></div>',

                    'email' =>
                        '<div class="email_re"><input id="email" type="text" value="' . esc_attr(  $commenter['comment_author_email'] ) .'" name="email" placeholder="'.__('E-mail', 'rehub_framework').'"></div>',

                    'url' =>
                        '<div class="site_re end"><input id="url" type="text" value="' . esc_attr( $commenter['comment_author_url'] ) .'" name="url" placeholder="'.__('Website', 'rehub_framework').'"></div><div class="clearfix"></div>',
                )
              ),
            ));

任何提示将不胜感激。谢谢:-)

1 个答案:

答案 0 :(得分:0)

替换以下行:

'title_reply'           => __('Leave a Review', 'rehub_framework'),

'title_reply'           => 'Leave your '. $offer_title .' Review',