我编辑了评论表单以删除一些字段,现在已批准的评论不会显示,只显示表单本身。
我错过了什么?
<?php
$comment_args = array(
\'fields\' => apply_filters(
\'comment_form_default_fields\', array(
\'author\' => \'<p class="comment-form-author">\' .
\'<label for="author">\' . __( \'Name_\' ) . \'</label> \' .
( $req ? \'<span class="required">*</span>\' : \'\' ) .
\'<input id="author" name="author" type="text" value="\' .
esc_attr( $commenter[\'comment_author\'] ) . \'" size="30"\' . $aria_req . \' />\' .
\'</p><!-- #form-section-author .form-section -->\',
\'url\' => \'\'
)
),
\'comment_field\' => \'<p class="comment-form-comment">\' .
\'<label for="comment">\' . __( \'\' ) . \'</label>\' .
\'<textarea id="comment" name="comment" cols="45" rows="8" aria-required="true"></textarea>\' .
\'</p><!-- #form-section-comment .form-section -->\',
\'comment_notes_after\' => \'\',
\'title_reply\' => \'Leave a Comment\',
\'comment_notes_before\' => \'\',
);
comment_form( $comment_args );
?>
没有评论列表的迹象?即使添加wp_list_注释也不起作用。
有人能帮忙吗,非常感谢?
SO网友:Shelly
我觉得你的格式有点不对劲。我会这样尝试:
<?php $fields = array(
\'author\' => \'<p><label for="author"><span class="req">* </span>\' . __( \'Name\' ) . \'</label><input id="author" name="author" type="text" value="\' . esc_attr( $commenter[\'comment_author\'] ) . \'" size="30"\' . $aria_req . \' /></p>\',
\'email\' => \'<p><label for="email"><span class="req">* </span>\' . __( \'Email\' ) . \'</label><input id="email" name="email" type="text" value="\' . esc_attr( $commenter[\'comment_author_email\'] ) . \'" size="30"\' . $aria_req . \' /></p>\',
\'url\' => \'\',
);
$theme_defaults = array(
\'comment_field\' => \'<p class="comment-form-comment">\' . \'<label for="comment">\' . __( \'\' ) . \'</label>\' . \'<textarea id="comment" name="comment" cols="45" rows="8" aria-required="true"></textarea>\' . \'</p><!-- #form-section-comment .form-section -->\',
\'comment_notes_after\' => \'\',
\'title_reply\' => \'Leave a Comment\',
\'comment_notes_before\' => \'\',
);
comment_form( $comment_args ); ?>
资料来源:
WordPress Codex