簡體   English   中英

如何在評論標題中插入wordpress帖子值?

[英]How to insert a wordpress post value into the comments title?

我正在嘗試將wordpress post值$ offer_title插入到評論框標題中。 標題目前顯示為“保留您的評論”,但我希望它在“評論”部分之前顯示$ offer_title值,例如“保留您的XYZ評論”。

這是評論部分的當前代碼......

$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>',
                )
              ),
            ));

任何提示將非常感激。 謝謝 :-)

替換說明的行:

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

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM