无法修改WordPress中的评论表单

时间:2017-12-26 09:55:56

标签: wordpress

我试图将作者,电子邮件字段添加到评论表单中,但评论表单不会更改。它始终显示一个默认模板,只包含注释字段和提交按钮。

这可能是一个缓存问题还是从另一个目录中读取评论表单模板?

我在页面模板中使用此代码:

$comments_args = array(
  'label_submit' => __('コメント送信'),
  'title_reply' => __('コメント登録'),
  'fields' => apply_filters('comment_form_default_fields', array(
    'author' =>
    '<p class="comment-form-author">'.
    '<input id="author" class="blog-form-input" placeholder="Your Name* " name="author" type="text" value="'.esc_attr($commenter['comment_author']).
    '" size="30"'.$aria_req.
    ' /></p>',
    'email' =>
    '<p class="comment-form-email">'.
    '<input id="email" class="blog-form-input" placeholder="Your Email Address* " name="email" type="text" value="'.esc_attr($commenter['comment_author_email']).
    '" size="30"'.$aria_req.
    ' /></p>',
  )),
  'comment_notes_after' => '',
  'comment_field' => '<p class="comment-form-comment"><label for="comment">'._x('Comment', 'noun').
  '</label><br /><textarea id="comment" name="comment" aria-required="true" cols="75"></textarea></p>',
);
comment_form($comments_args);

1 个答案:

答案 0 :(得分:0)

<?php 
$comment_args = array( 'title_reply'=>'Got Something To Say:',

'fields' => apply_filters( 'comment_form_default_fields', array(

'author' => '<p class="comment-form-author">' . '<label for="author">' . __( 'Your Good Name' ) . '</label> ' . ( $req ? '<span>*</span>' : '' ) .

        '<input id="author" name="author" type="text" value="' . esc_attr( $commenter['comment_author'] ) . '" size="30"' . $aria_req . ' /></p>',   

    'email'  => '<p class="comment-form-email">' .

                '<label for="email">' . __( 'Your Email Please' ) . '</label> ' .

                ( $req ? '<span>*</span>' : '' ) .

                '<input id="email" name="email" type="text" value="' . esc_attr(  $commenter['comment_author_email'] ) . '" size="30"' . $aria_req . ' />'.'</p>',

    'url'    => '' ) ),

    'comment_field' => '<p>' .

                '<label for="comment">' . __( 'Let us know what you have to say:' ) . '</label>' .

                '<textarea id="comment" name="comment" cols="45" rows="8" aria-required="true"></textarea>' .

                '</p>',

    'comment_notes_after' => '',

);

comment_form($comment_args); ?>

我希望这对你有用

相关问题