我退出时有此评论表:
现在,我想将此消息框移到名称和电子邮件框下方吗?
您能告诉我该怎么做吗?
functions.php代码:
function comment_default_fields ( $fields ) {
unset($fields['author']);
unset($fields['email']);
unset($fields['url']);
$fields[] = '<div class="row">';
$fields['author'] = '<div class="col-lg-6 col-md-6">
<div class="single-input">
<label for="commenter-name">Name</label>
<input type="text" name="commenter-name" id="commenter-name" placeholder="Your name here..">
</div>
</div>';
$fields['email'] = '<div class="col-lg-6 col-md-6">
<div class="single-input">
<label for="commenter-email">Email</label>
<input type="email" name="commenter-email" id="commenter-email" placeholder="Your email here..">
</div>
</div>';
$fields[] = '</div>';
return $fields;
}
add_filter( 'comment_form_default_fields', 'comment_default_fields' );
comments.php代码
$comments_args = array(
'label_submit'=>'Submit Your Comment',
'title_reply'=>'Write a Reply or Comment',
'comment_field' => '<div class="row"><div class="col-lg-12">
<div class="single-input">
<label for="commenter-message">Message</label>
<textarea name="comment" id="commenter-message" cols="30" rows="5" placeholder="Your message here.."></textarea>
</div>
</div></div>',
'submit_button' => '<div class="row"><div class="col-lg-12">
<div class="single-input">
<input name="submit" type="submit" id="submit" class="submit cr-btn" value="Submit Your Comment">
</div>
</div></div>'
);
echo '<div class="blog-details-block commentbox">';
comment_form($comments_args);
echo '</div>';
答案 0 :(得分:2)
将此添加到您的 functions.php
function move_comment_field_to_bottom( $fields ) {
$comment_field = $fields['comment'];
unset( $fields['comment'] );
$fields['comment'] = $comment_field;
return $fields;
}
add_filter( 'comment_form_fields', 'move_comment_field_to_bottom' );
请记住,对于所有更改,请使用child theme,否则在您使用的主题的下一次更新时将其删除。