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

WordPress Trac noreply at wordpress.org
Fri Sep 25 13:56:57 UTC 2015


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

Comment (by DrewAPicture):

 Citing @greenshady's comment:11 on breaking away from template vs
 stylesheet, I've added [attachment:30797.diff].

 It introduces an argument to `get_stylesheet_uri()` to optionally retrieve
 the parent stylesheet:
 {{{
 #!php
 <?php
 function _s_scripts() {

         if ( is_child_theme() ) {
                 wp_enqueue_style( '_s-parent-style', get_stylesheet_uri(
 'parent' ) );
         }

         wp_enqueue_style( '_s-style', get_stylesheet_uri() );
 }
 add_action( 'wp_enqueue_scripts', '_s_scripts' );
 }}}

 If `$type` is 'parent' and the parent theme exists, pull via
 `get_template_directory_uri()`.

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


More information about the wp-trac mailing list