Skip to content

Instantly share code, notes, and snippets.

@robskidmore
Created February 24, 2015 17:10
Show Gist options
  • Save robskidmore/e757aacca7c837214aa3 to your computer and use it in GitHub Desktop.
Save robskidmore/e757aacca7c837214aa3 to your computer and use it in GitHub Desktop.
Wordpress Comments Placeholders
function modify_comment_form_fields($fields){
$commenter = wp_get_current_commenter();
$req = get_option( 'require_name_email' );
$aria_req = ( $req ? " aria-required='true'" : "" );
$fields['author'] = '<p class="comment-form-author">' .
'<input id="author" name="author" type="text" placeholder="Name*" value="' . esc_attr( $commenter['comment_author'] ) . '" size="20"' . $aria_req . ' /></p>';
$fields['email'] = '<p class="comment-form-email">'.
'<input id="email" name="email" type="text" placeholder="Email*" value="' . esc_attr( $commenter['comment_author_email'] ) .
'" size="30"' . $aria_req . ' /></p>';
$fields['url'] = '<p class="comment-form-url">' .
'<input id="url" name="url" type="text" placeholder="Website" value="' . esc_attr( $commenter['comment_author_url'] ) .
'" size="30" /></p>';
return $fields;
}
add_filter('comment_form_default_fields','modify_comment_form_fields');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment