[wp-trac] [WordPress Trac] #28174: Responsive code separation

WordPress Trac noreply at wordpress.org
Tue May 13 13:15:56 UTC 2014


#28174: Responsive code separation
-------------------------------+---------------------------------------
 Reporter:  cyberwani          |       Owner:
     Type:  feature request    |      Status:  new
 Priority:  normal             |   Milestone:  Awaiting Review
Component:  Bundled Theme      |     Version:  3.9
 Severity:  normal             |  Resolution:
 Keywords:  reporter-feedback  |     Focuses:  ui, javascript, template
-------------------------------+---------------------------------------

Comment (by cyberwani):

 Like currently Twenty Twelve contains the below code in functions.php.
 {{{
 #!php
 wp_enqueue_script( 'twentytwelve-navigation', get_template_directory_uri()
 . '/js/navigation.js', array( 'jquery' ), '20140318', true );
 }}}

 This code part can be called inside any function. So, user can call the
 function to on/off through child function. Something like this.
 {{{
 #!php
 function twentytwelve_responsive(){
     add_action( 'wp_enqueue_scripts',
 'twentytwelve_responsive_scripts_styles' );
 }
 function twentytwelve_responsive_scripts_styles(){
     wp_enqueue_script( 'twentytwelve-navigation',
 get_template_directory_uri() . '/js/navigation.js', array( 'jquery' ),
 '20140318', true );
     wp_enqueue_style( 'twentytwelve-responsive-css',
 get_template_directory_uri() . '/css/responsive.css', array(
 'twentytwelve-style' ), '20121010' );
 }
 }}}

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


More information about the wp-trac mailing list