Skip to content

Instantly share code, notes, and snippets.

@thachpham92
Created May 27, 2013 11:00
Show Gist options
  • Save thachpham92/5656497 to your computer and use it in GitHub Desktop.
Save thachpham92/5656497 to your computer and use it in GitHub Desktop.
Custom comment form
//Custom the comment_form
function custom_comment_form() {
$commenter = wp_get_current_commenter();
$req = get_option( 'require_name_email' );
$aria_req = ( $req ? " aria-required='true'" : '' );
$fields = array(
'author' => '<p class="comment-form-author">' . '<label for="author">' . __( 'Name','thachpham' ) . '</label> ' . ( $req ? '' : '' ) .
'<input id="author" placeholder="'.__('Enter your name','thachpham').'" name="author" type="text" value="' . esc_attr( $commenter['comment_author'] ) . '" size="30"' . $aria_req . ' /></p>',
'email' => '<p class="comment-form-email"><label for="email">' . __( 'Email' ) . '</label> ' . ( $req ? '' : '' ) .
'<input id="email" placeholder="'.__('Enter your email','thachpham').'" name="email" type="text" value="' . esc_attr( $commenter['comment_author_email'] ) . '" size="30"' . $aria_req . ' /></p>',
'url' => '<p class="comment-form-url"><label for="url">' . __( 'Website' ) . '</label>' .
'<input id="url" placeholder="'.__('Enter your website url').'" name="url" type="text" value="' . esc_attr( $commenter['comment_author_url'] ) . '" size="30" /></p>',
);
$comments_args = array(
'fields' => $fields,
'title_reply'=>__('Leave a comment','thachpham'),
'label_submit' => __('Submit comment','thachpham'),
);
comment_form($comments_args);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment