以下是我使用的代码:
代码片段如下-
我在评论表单字段中使用了自定义标记,当我提交表单时,它会将我带到另一篇帖子的评论。此代码中可能存在什么问题?
$fields = array(
'author' => ' <div class="form-group col-md-4">' . ' <input type="text" class="form-control" id="name" name="name" placeholder="Name" value="' . esc_attr( $commenter['comment_author'] ) . '" size="30"' . ' ></div>',
'email' => ' <div class="form-group col-md-4">' . ' <input type="email" class="form-control" id="email" name="email" placeholder="Email" value="' . esc_attr( $commenter['comment_author_email'] ) . '" size ="30" ' . ' ></div>',
);
$comments_args = array(
'fields' => $fields,
'comment_field' => ' <div class="form-group col-12">
<textarea class="form-control" id="comment" name="comment" placeholder="Comment"></textarea>
</div>
<!-- Single Form End -->
',
'class_form' => 'from_main row',
'title_reply_before' => '',
'title_reply_after' => '',
'label_submit' => 'Submit',
'submit_button' => '
提交',
);
if ( comments_open() || pings_open() ) {
if ( $comments ) {
echo '<hr class="styled-separator is-style-wide" aria-hidden="true" />';
}
comment_form( $comments_args );
if ( $comments ) {
echo '<hr class="styled-separator is-style-wide" aria-hidden="true" />';
}
} elseif ( is_single() ) {
if ( $comments ) {
echo '<hr class="styled-separator is-style-wide" aria-hidden="true" />';
}
?>
谢谢