Make WordPress Core

Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#36605 closed defect (bug) (invalid)

Input types of URL and number do not render correctly in customizer

Reported by: dpegasusm's profile dpegasusm Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.5
Component: Customize Keywords: reporter-feedback
Focuses: Cc:

Description

I have the following code adding an input type to the customizer:

<?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.

Attachments (2)

36605-ok.png (168.8 KB) - added by westonruter 9 years ago.
Screen Shot 2016-04-21 at 10.50.23 AM.png (40.0 KB) - added by dpegasusm 9 years ago.
issue

Download all attachments as: .zip

Change History (6)

@westonruter
9 years ago

#1 @westonruter
9 years ago

  • Keywords reporter-feedback added

I can't seem to reproduce this issue. See 36605-ok.png which is what I see with the following plugin added:

<?php
add_action( 'customize_register', function( WP_Customize_Manager $wp_customize ) {

        $wp_customize->add_setting( 'my_counter', array(
                'default' => 0,
        ) );
        $wp_customize->add_control( 'my_counter', array(
                        'label'          => __( 'Number of items to show:', 'language' ),
                        'section'        => 'title_tagline',
                        'settings'       => 'my_counter',
                        'type'           => 'number',
                        'input_attrs'    => array(
                                'min'  => 0,
                                'max'   => 10,
                        ),
                )
        );

        $wp_customize->add_setting( 'my_url', array(
                'default' => 'http://example.com/',
        ) );
        $wp_customize->add_control( 'my_url', array(
                        'label'          => __( 'URL:', 'language' ),
                        'section'        => 'title_tagline',
                        'settings'       => 'my_url',
                        'type'           => 'url',
                )
        );

}, 100 );

#2 @dpegasusm
9 years ago

  • Resolution set to invalid
  • Status changed from new to closed

#3 @dpegasusm
9 years ago

Figured it out as an odd interaction between the plugin and another plugin.

#4 @netweb
9 years ago

  • Milestone Awaiting Review deleted
Note: See TracTickets for help on using tickets.