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

WordPress Trac noreply at wordpress.org
Fri Oct 9 22:22:22 UTC 2015


#30797: New function for parent theme stylesheet uri
----------------------------+-----------------------------
 Reporter:  grapplerulrich  |       Owner:  obenland
     Type:  enhancement     |      Status:  assigned
 Priority:  normal          |   Milestone:  Future Release
Component:  Themes          |     Version:  trunk
 Severity:  normal          |  Resolution:
 Keywords:  needs-patch     |     Focuses:
----------------------------+-----------------------------

Comment (by grapplerulrich):

 I have uploaded a new patch. I went with returning false when a child
 theme is not active is because of `wp_enqueue_style()`. The URI is not
 added if it returns false.

 Code snippet from `wp_enqueue_style()`
 {{{#!php
 if ( $src ) {
         $_handle = explode('?', $handle);
         $wp_styles->add( $_handle[0], $src, $deps, $ver, $media );
 }
 }}}

 I am not sure how I would implement the function in a theme if it did not
 return the current theme URI if a child theme was not active. The code
 that I previously would have been:
 {{{#!php
 wp_enqueue_style( '_s-style', get_template_stylesheet_uri() );
 if ( is_child_theme() ) {
         wp_enqueue_style( '_s-child-style', get_stylesheet_uri() );
 }
 }}}

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


More information about the wp-trac mailing list