有点晚了,但您也可以将以下内容添加到主题的功能中。php文件:
/** Comment Form Function Defaults */
add_filter(\'comment_form_defaults\',\'my_comment_defaults\');
function my_comment_defaults($defaults) {
global $user_identity, $id;
if ( isset($post_id) )
$id = $post_id;
else
$post_id = $id;
$commenter = wp_get_current_commenter();
$req = get_option( \'require_name_email\' );
$aria_req = ( $req ? " aria-required=\'true\'" : \'\' );
$fields = array(
\'author\' => \'<div class="comment-form-author">\' . \'<label for="author">\' . __( \'Name:\' ) . ( $req ? \' <span class="required">*</span>\' : \'\' ) .
\'</label><input id="author" name="author" type="text" value="\' . esc_attr( $commenter[\'comment_author\'] ) . \'" size="30"\' . $aria_req . \' /></div>\',
\'email\' => \'<div class="comment-form-email"><label for="email">\' . __( \'Email:\' ) . ( $req ? \' <span class="required">*</span>\' : \'\' ) .
\'</label><input id="email" name="email" type="text" value="\' . esc_attr( $commenter[\'comment_author_email\'] ) . \'" size="30"\' . $aria_req . \' /></div>\',
\'url\' => \'\',
);
$required_text = sprintf( \' \' . __(\'Required fields are marked %s\'), \'<span class="required">*</span>\' );
$defaults = array(
\'fields\' => apply_filters( \'comment_form_default_fields\', $fields ),
\'comment_field\' => \'<div class="comment-form-comment"><label for="comment">\' . _x( \'Comment:\', \'noun\' ) . \' <span class="required">*</span></label><textarea id="comment" name="comment" cols="45" rows="8" aria-required="true"></textarea></div>\',
\'must_log_in\' => \'<p class="must-log-in">\' . sprintf( __( \'You must be <a href="%s">logged in</a> to post a comment.\' ), wp_login_url( apply_filters( \'the_permalink\', get_permalink( $post_id ) ) ) ) . \'</p>\',
\'logged_in_as\' => \'<p class="logged-in-as">\' . sprintf( __( \'Logged in as <a href="%1$s">%2$s</a>. <a href="%3$s" title="Log out of this account">Log out?</a>\' ), admin_url( \'profile.php\' ), $user_identity, wp_logout_url( apply_filters( \'the_permalink\', get_permalink( $post_id ) ) ) ) . \'</p>\',
\'comment_notes_before\' => \'<p class="comment-notes"><em>Note: </em>\' . __( \'Your email address will not be published.\' ) . ( $req ? $required_text : \'\' ) . \'</p>\',
\'comment_notes_after\' => \'<p class="form-allowed-tags">\' . sprintf( __( \'You may use these <abbr title="HyperText Markup Language">HTML</abbr> tags and attributes: %s\' ), \' <code>\' . allowed_tags() . \'</code>\' ) . \'</p>\',
\'id_form\' => \'commentform\',
\'id_submit\' => \'submit\',
\'title_reply\' => __( \'Leave a Reply\' ),
\'title_reply_to\' => __( \'Leave a Reply to %s\' ),
\'cancel_reply_link\' => __( \'Cancel reply\' ),
\'label_submit\' => __( \'Post Comment\' ),
);
return $defaults;
}
这可能有点过头了,但它还可以让您控制注释表单的其他字段和属性。