评论文本区域显示两次-自定义wordpress评论表单
我为自定义注释表单提供了以下代码:评论文本区域显示两次-自定义wordpress评论表单,wordpress,Wordpress,我为自定义注释表单提供了以下代码: <?php $fields = array( 'fields' => apply_filters( 'comment_form_default_fields', array( 'author' => '<p class="comment-form-author"><input id="author" name="author" type="text" value="" placeholder="
<?php $fields = array(
'fields' => apply_filters( 'comment_form_default_fields', array(
'author' =>
'<p class="comment-form-author"><input id="author" name="author" type="text" value="" placeholder="*Please enter your name..." aria-required="true" /></p>',
'email' =>
'<p class="comment-form-email"><input id="email" name="email" type="text" value="" placeholder="*Please enter your email..." aria-required="true" /></p>',
'comment_field' =>
'<p class="comment-form-comment"><textarea id="comment" placeholder="*Please type your message here..." name="comment" cols="45" rows="8" aria-required="true"></textarea></p>',
)),
'comment_notes_after' => '',
); ?>
<div class="comments-form"><?php comment_form($fields); ?></div>
这一问题现已解决。comment_字段不应位于“fields”数组中,因为它是comment_form()函数的一个独特参数。因此,它应该是:
<?php $fields = array(
'fields' => apply_filters( 'comment_form_default_fields', array(
'author' =>
'<p class="comment-form-author"><input id="author" name="author" type="text" value="" placeholder="*Please enter your name..." aria-required="true" /></p>',
'email' =>
'<p class="comment-form-email"><input id="email" name="email" type="text" value="" placeholder="*Please enter your email..." aria-required="true" /></p>',
)),
'comment_field' =>
'<p class="comment-form-comment"><textarea id="comment" placeholder="*Please type your message here..." name="comment" cols="45" rows="8" aria-required="true"></textarea></p>',
'comment_notes_after' => '',
); ?>
这一问题现已解决。comment_字段不应位于“fields”数组中,因为它是comment_form()函数的一个独特参数。因此,它应该是:
<?php $fields = array(
'fields' => apply_filters( 'comment_form_default_fields', array(
'author' =>
'<p class="comment-form-author"><input id="author" name="author" type="text" value="" placeholder="*Please enter your name..." aria-required="true" /></p>',
'email' =>
'<p class="comment-form-email"><input id="email" name="email" type="text" value="" placeholder="*Please enter your email..." aria-required="true" /></p>',
)),
'comment_field' =>
'<p class="comment-form-comment"><textarea id="comment" placeholder="*Please type your message here..." name="comment" cols="45" rows="8" aria-required="true"></textarea></p>',
'comment_notes_after' => '',
); ?>
回答得好,它帮了我的忙。以下是我的解决方案:
$fields = array(
'author' => '<p class="comment-form-author">' . '<label for="author">' . __( 'Name' ) . '</label><br /> ' . ( $req ? '<span class="required">*</span>' : '' ) .
'<input id="author" name="author" type="text" size="30"' . $aria_req . ' /></p>',
'email' => '<p class="comment-form-email"><label for="email">' . __( 'Email' ) . '</label><br /> ' . ( $req ? '<span class="required">*</span>' : '' ) .
'<input id="email" name="email" type="text" size="30"' . $aria_req . ' /></p>',
);
$comments_args = array(
'fields' => $fields,
'comment_field' => '<p class="comment-form-comment"><label for="comment">' . _x( 'Comment', 'noun' ) . '</label> <br /> <textarea id="comment" name="comment" cols="45" rows="8" maxlength="65525" aria-required="true" required="required"></textarea></p>',
);
comment_form($comments_args);
$fields=数组(
“author'=>”“.”.uuu('Name').
.($req?'*':'')。
“
”,
“email'=>”。”(“email”)。
。”($req?“*”:“”)。
“
”,
);
$comments\u args=数组(
“字段”=>$fields,
“comment\u field'=>”。\u x('comment',noon')。
,
);
注释表($comments\u args);
我知道这是一个3年前的问题,但这是我在这个问题上得到的很少的结果之一,所以我想我会回答它,以防它对其他人有帮助 回答得好,它帮了我的忙。以下是我的解决方案:
$fields = array(
'author' => '<p class="comment-form-author">' . '<label for="author">' . __( 'Name' ) . '</label><br /> ' . ( $req ? '<span class="required">*</span>' : '' ) .
'<input id="author" name="author" type="text" size="30"' . $aria_req . ' /></p>',
'email' => '<p class="comment-form-email"><label for="email">' . __( 'Email' ) . '</label><br /> ' . ( $req ? '<span class="required">*</span>' : '' ) .
'<input id="email" name="email" type="text" size="30"' . $aria_req . ' /></p>',
);
$comments_args = array(
'fields' => $fields,
'comment_field' => '<p class="comment-form-comment"><label for="comment">' . _x( 'Comment', 'noun' ) . '</label> <br /> <textarea id="comment" name="comment" cols="45" rows="8" maxlength="65525" aria-required="true" required="required"></textarea></p>',
);
comment_form($comments_args);
$fields=数组(
“author'=>”“.”.uuu('Name').
.($req?'*':'')。
“
”,
“email'=>”。”(“email”)。
。”($req?“*”:“”)。
“
”,
);
$comments\u args=数组(
“字段”=>$fields,
“comment\u field'=>”。\u x('comment',noon')。
,
);
注释表($comments\u args);
我知道这是一个3年前的问题,但这是我在这个问题上得到的很少的结果之一,所以我想我会回答它,以防它对其他人有帮助