Created
February 24, 2015 17:10
-
-
Save robskidmore/e757aacca7c837214aa3 to your computer and use it in GitHub Desktop.
Wordpress Comments Placeholders
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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