[wp-trac] [WordPress Trac] #47692: Optgroup in Customizer Select Control

WordPress Trac noreply at wordpress.org
Sat Jul 13 07:15:12 UTC 2019


#47692: Optgroup in Customizer Select Control
-------------------------+------------------------------
 Reporter:  chintan1896  |       Owner:  (none)
     Type:  enhancement  |      Status:  new
 Priority:  normal       |   Milestone:  Awaiting Review
Component:  Customize    |     Version:  trunk
 Severity:  normal       |  Resolution:
 Keywords:  has-patch    |     Focuses:
-------------------------+------------------------------

Comment (by chintan1896):

 Example for select optgroup

 {{{#!php
 <?php
 $wp_customize->add_control( new WP_Customize_Control( $wp_customize,
 'optgroup_example', array(
                 'label'                         => esc_attr__( 'Optgroup
 example', 'wooco' ),
                 'setting'                       => 'optgroup_example',
                 'type'              => 'select',
         'optgroup'          => true,
                 'choices'           =>  array(
                                     'optgroup-label-1' => array(
 'value-1'=> __( 'value-1' )
                                                         ),
                                     'optgroup-label-2' => array(
 'value-2'=> __( 'value-2' )
                                                         ),
                                 ),
         ) ) );
 }}}

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/47692#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list