Created
April 3, 2013 21:28
-
-
Save claudiosanches/5305514 to your computer and use it in GitHub Desktop.
WordPress - Custom comment_form fields
This file contains hidden or 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
<?php | |
/** | |
* Custom comment_form fields | |
* | |
* @param array $fields Default form fields | |
* | |
* @return array New Form fields | |
*/ | |
function custom_comment_form_field( $fields ) { | |
$commenter = wp_get_current_commenter(); | |
$req = get_option( 'require_name_email' ); | |
$aria_req = ( $req ? " aria-required='true'" : '' ); | |
$fields['email'] = '<p class="comment-form-email"><label for="email">' . __( 'Email', 'odin' ) . ' ' . ( $req ? '<span class="required">*</span>' : '' ) . '</label><input id="email" name="email" type="email" value="' . esc_attr( $commenter['comment_author_email'] ) . '" size="30"' . $aria_req . ' /></p>'; | |
return $fields; | |
} | |
add_filter( 'comment_form_default_fields', 'custom_comment_form_field' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment