Created
July 12, 2011 06:41
-
-
Save yatil/1077512 to your computer and use it in GitHub Desktop.
html5 input types in wordpress w/ required attribute
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
<?php | |
/* | |
Plugin Name: html5 input-types | |
Plugin URI: http://notizblog.org/ | |
Description: Adds the new HTML5 input-types to WordPress' default forms | |
Version: 0.1 | |
Author: pfefferle | |
Author URI: http://notizblog.org/ | |
*/ | |
add_filter("comment_form_default_fields", "change_comment_input_types"); | |
function change_comment_input_types($fields) { | |
$fields['email'] = preg_replace('/"text"/', '"email" required', $fields['email']); | |
$fields['url'] = preg_replace('/"text"/', '"url" required', $fields['url']); | |
return $fields; | |
} | |
add_filter("get_search_form", "change_search_form_input_types"); | |
function change_search_form_input_types($form) { | |
return preg_replace('/"text"/', '"search"', $form); | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment