[wp-trac] [WordPress Trac] #36605: Input types of URL and number do not render correctly in customizer

WordPress Trac noreply at wordpress.org
Wed Apr 20 14:08:47 UTC 2016


#36605: Input types of URL and number do not render correctly in customizer
--------------------------+-----------------------------
 Reporter:  dpegasusm     |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Customize     |    Version:  4.5
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 I have the following code adding an input type to the customizer:

 {{{#!php
 <?php
 $wp_customize->add_control(  'my_counter_control', //Set a unique ID for
 the control
                         array(
                                 'label'          => __( 'Number of items
 to show:', 'language' ),
                                 'section'        => 'my_section',
                                 'settings'       => 'my_setting',
                                 'type'           => 'number',
                                 'input_attrs'    => array(
                                         'min'  => 0,
                                         'max'   => 10
                                 )
                         )
                 );
 }}}

 when rendered the html on inspection is:

 {{{
 <input type="text" value="">
 }}}

 and not the number with a min and max value

 Changing a value in the field does not cause the save button to change to
 "Save and Publish" either and changing another field and saving the
 customizer does not affect the value of this field.

 in the page source the correct item appears in the customize settings
 array:

 {{{
 s["my_setting"] = {"value":"6","transport":"refresh","dirty":false};
 }}}

 and later on:

 {{{
 c["my_setting"] =
 {"settings":{"default":"my_setting"},"type":"number","priority":10,"active":true,"section":"my_section","content":"<li
 id=\"customize-control-my_setting\" class=\"customize-control customize-
 control-number\">\n\t\t\t\t\t\t\t<label>\n\t\t\t\t\t\t\t\t\t\t\t<span
 class=\"customize-control-title\">Number of Items to
 show:<\/span>\n\t\t\t\t\t\t\t\t\t\t<input type=\"number\" min=\"0\"
 max=\"10\"  value=\"6\" data-customize-setting-link=\"my_setting\"
 \/>\n\t\t\t\t<\/label>\n\t\t\t\t\t\t<\/li>","label":"Number of Items to
 show:","description":"","instanceNumber":39};
 }}}

 This is also happening to URL fields.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/36605>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list