[wp-trac] [WordPress Trac] #30797: New function for parent theme stylesheet uri

WordPress Trac noreply at wordpress.org
Sat Dec 20 22:45:55 UTC 2014


#30797: New function for parent theme stylesheet uri
----------------------------+------------------------------
 Reporter:  grapplerulrich  |       Owner:
     Type:  enhancement     |      Status:  new
 Priority:  normal          |   Milestone:  Awaiting Review
Component:  Themes          |     Version:  trunk
 Severity:  normal          |  Resolution:
 Keywords:                  |     Focuses:
----------------------------+------------------------------

Comment (by grapplerulrich):

 '''@greenshady''' - Thanks!

 > It'd also force all existing themes to change their code to meet a new
 requirement that isn't necessary.
 What requirement do you mean? It is optional to use the function.

 One reason why I don't like the method you mentioned is that the handle
 switches when activating the child theme. The second reason is that it
 does not work when you want to include a second stylesheet after the main
 stylesheet like this:


 {{{
 function _s_scripts() {

         if ( is_child_theme() ) {
                 wp_enqueue_style( '_s-parent-style',
 get_parent_stylesheet_uri() );
         }
         wp_enqueue_style( '_s-layout', get_template_directory_uri() .
 '/layouts/content-sidebar.css' );
         wp_enqueue_style( '_s-style', get_stylesheet_uri() );
 }
 add_action( 'wp_enqueue_scripts', '_s_scripts' );
 }}}

 Do you know of any plugins hooking into `stylesheet_uri`?

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


More information about the wp-trac mailing list