Make WordPress Core

Ticket #20579: 20579.2.diff

File 20579.2.diff, 4.2 KB (added by georgestephanis, 13 years ago)

Added in filter to use html5 input fields in comment forms. :)

  • wp-content/themes/twentyten/style.css

     
    307307        top: .5ex;
    308308}
    309309input[type="text"],
     310input[type="password"],
     311input[type="date"],
     312input[type="datetime"],
     313input[type="datetime-local"],
     314input[type="email"],
     315input[type="month"],
     316input[type="number"],
     317input[type="search"],
     318input[type="tel"],
     319input[type="time"],
     320input[type="url"],
     321input[type="week"],
    310322textarea {
    311323        background: #f9f9f9;
    312324        border: 1px solid #ccc;
     
    315327        -webkit-box-shadow: inset 1px 1px 1px rgba(0,0,0,0.1);
    316328        padding: 2px;
    317329}
     330input[type="search"] {
     331        -webkit-appearance: textfield;
     332}
     333input[type="search"]::-webkit-search-decoration {
     334        display: none;
     335}
    318336a:link {
    319337        color: #0066cc;
    320338}
  • wp-content/themes/twentyeleven/style.css

     
    434434/* Forms */
    435435input[type=text],
    436436input[type=password],
     437input[type=date],
     438input[type=datetime],
     439input[type=datetime-local],
     440input[type=email],
     441input[type=month],
     442input[type=number],
     443input[type=search],
     444input[type=tel],
     445input[type=time],
     446input[type=url],
     447input[type=week],
    437448textarea {
    438449        background: #fafafa;
    439450        -moz-box-shadow: inset 0 1px 1px rgba(0,0,0,0.1);
     
    443454        color: #888;
    444455}
    445456input[type=text]:focus,
     457input[type=password]:focus,
     458input[type=date]:focus,
     459input[type=datetime]:focus,
     460input[type=datetime-local]:focus,
     461input[type=email]:focus,
     462input[type=month]:focus,
     463input[type=number]:focus,
     464input[type=search]:focus,
     465input[type=tel]:focus,
     466input[type=time]:focus,
     467input[type=url]:focus,
     468input[type=week]:focus,
    446469textarea:focus {
    447470        color: #373737;
    448471}
     
    450473        padding-left: 3px;
    451474        width: 98%;
    452475}
    453 input[type=text] {
     476input[type=text],
     477input[type=password],
     478input[type=date],
     479input[type=datetime],
     480input[type=datetime-local],
     481input[type=email],
     482input[type=month],
     483input[type=number],
     484input[type=search],
     485input[type=tel],
     486input[type=time],
     487input[type=url],
     488input[type=week] {
    454489        padding: 3px;
    455490}
     491input[type="search"] {
     492        -webkit-appearance: textfield;
     493}
     494input[type="search"]::-webkit-search-decoration {
     495        display: none;
     496}
    456497input#s {
    457498        background: url(images/search.png) no-repeat 5px 6px;
    458499        -moz-border-radius: 2px;
     
    20482089        width: 68.9%;
    20492090}
    20502091#respond input[type="text"],
     2092#respond input[type="email"],
     2093#respond input[type="url"],
    20512094#respond textarea {
    20522095        background: #fff;
    20532096        border: 4px solid #eee;
     
    20852128        z-index: 1;
    20862129}
    20872130#respond input[type="text"]:focus,
     2131#respond input[type="email"]:focus,
     2132#respond input[type="url"]:focus,
    20882133#respond textarea:focus {
    20892134        text-indent: 0;
    20902135        z-index: 1;
     
    21752220#respond label {
    21762221        line-height: 2.2em;
    21772222}
    2178 #respond input[type=text] {
     2223#respond input[type=text],
     2224#respond input[type=email],
     2225#respond input[type=url] {
    21792226        display: block;
    21802227        height: 24px;
    21812228        width: 75%;
     
    24482495                top: 2.2em;
    24492496        }
    24502497        /* Use the available space in the smaller comment form */
    2451         #respond input[type="text"] {
     2498        #respond input[type="text"],
     2499        #respond input[type="email"],
     2500        #respond input[type="url"] {
    24522501                width: 95%;
    24532502        }
    24542503        #respond .comment-form-author .required,
  • wp-content/themes/twentyeleven/functions.php

     
    586586}
    587587add_filter( 'body_class', 'twentyeleven_body_classes' );
    588588
     589/**
     590 * Changes the comment form to use HTML5 input fields for email and url.
     591 *
     592 * @since Twenty Eleven 1.4
     593 */
     594function twentyeleven_html5_comment_fields( $fields ) {
     595        if( isset( $fields['email'] ) )
     596                $fields['email'] = str_replace( 'type="text"', 'type="email"', $fields['email'] );
     597        if( isset( $fields['url'] ) )
     598                $fields['url'] = str_replace( 'type="text"', 'type="url"', $fields['url'] );
     599        return $fields;
     600}
     601add_filter( 'comment_form_default_fields', 'twentyeleven_html5_comment_fields' );
     602