[wp-trac] [WordPress Trac] #28174: Responsive code separation
WordPress Trac
noreply at wordpress.org
Thu May 22 02:32:46 UTC 2014
#28174: Responsive code separation
-----------------------------+---------------------------------------
Reporter: cyberwani | Owner:
Type: feature request | Status: closed
Priority: normal | Milestone:
Component: Bundled Theme | Version:
Severity: normal | Resolution: invalid
Keywords: | Focuses: ui, javascript, template
-----------------------------+---------------------------------------
Changes (by obenland):
* keywords: reporter-feedback =>
* status: new => closed
* version: 3.9 =>
* resolution: => invalid
* milestone: Awaiting Review =>
Comment:
Replying to [comment:2 cyberwani]:
Child themes can remove any action or filters that were added by a default
theme in a callback to `after_setup_theme`.
Example:
{{{
#!php
<?php
function twentytwelvechild_remove_hooks() {
remove_action( 'wp_enqueue_scripts', 'twentytwelve_scripts_styles'
);
}
add_action( 'after_setup_theme', 'twentytwelvechild_remove_hooks' );
}}}
After that they can register their own callback to `wp_enqueue_scripts`
and add the parent theme's scripts as needed.
Alternatively, child themes can hook into `wp_enqueue_scripts` on a
priority bigger than 10, and deregister/dequeue scripts or styles.
Separating out responsive styles into their own stylesheet is probably not
something that default themes are likely to do. In existing default themes
for backwards compatibility reasons, and in future default themes because
it would add another request to the server and most installs probably
won't have the ability to concatenate on the fly.
I would recommend creating a new stylesheet in your child theme that
contains the CSS bits from the parent theme that you want to keep, use
that, and dequeue the parent's default stylesheet.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/28174#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list