[wp-trac] [WordPress Trac] #30797: New function for parent theme stylesheet uri
WordPress Trac
noreply at wordpress.org
Sat Dec 20 19:08:05 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 greenshady):
I love the idea of having a `get_parent_stylesheet_uri()` function. Your
proposed function sounds great.
Your proposed usage could break plugins that work with the
`stylesheet_uri` filter hook. It'd also force all existing themes to
change their code to meet a new requirement that isn't necessary.
Doing it the following way keeps back-compatibility and requires no
changes to existing themes and plugins (this is the method I've been
recommending). It merely provides a method for loading the parent theme
stylesheet if needed.
{{{
function _s_scripts() {
if ( is_child_theme() ) {
wp_enqueue_style( '_s-parent-style',
get_parent_stylesheet_uri() );
}
wp_enqueue_style( '_s-style', get_stylesheet_uri() );
}
add_action( 'wp_enqueue_scripts', '_s_scripts' );
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/30797#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list