[wp-trac] [WordPress Trac] #41897: Code Editor: Add reusable code editor Customizer control

WordPress Trac noreply at wordpress.org
Sat Sep 16 21:58:19 UTC 2017


#41897: Code Editor: Add reusable code editor Customizer control
-------------------------------------+--------------------------
 Reporter:  westonruter              |       Owner:  westonruter
     Type:  defect (bug)             |      Status:  accepted
 Priority:  normal                   |   Milestone:  4.9
Component:  Customize                |     Version:
 Severity:  normal                   |  Resolution:
 Keywords:  has-patch needs-testing  |     Focuses:
-------------------------------------+--------------------------

Comment (by westonruter):

 Here's an example of how a plugin can add a code editor to a section, here
 specifically a code editor for HTML:

 {{{#!php
 <?php
 add_action( 'customize_register', function( WP_Customize_Manager
 $wp_customize ) {
         $wp_customize->add_setting( 'favorite_html' );
         $control = new WP_Customize_Code_Editor_Control( $wp_customize,
 'favorite_html', array(
                 'label' => 'My Favorite HTML',
                 'code_type' => 'text/html',
                 'settings' => 'favorite_html',
                 'section' => 'title_tagline',
         ) );
         $wp_customize->add_control( $control );
 } );
 }}}

 See also initial work-in-progress pull request to update Jetpack to make
 use of this API: https://github.com/Automattic/jetpack/pull/7794

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


More information about the wp-trac mailing list