Last active
August 29, 2015 14:07
-
-
Save grappler/3d6b46cecdf85b490604 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action( 'wp_enqueue_scripts', 'grappler_scripts' ); | |
function grappler_scripts() { | |
wp_enqueue_style( 'grappler-style', get_template_directory_uri() . '/output/style.css' ); | |
if ( is_child_theme() ) { | |
wp_enqueue_style( 'grappler-child-style', get_stylesheet_uri() ); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action( 'wp_enqueue_scripts', 'grappler_scripts' ); | |
function grappler_scripts() { | |
if ( is_child_theme() ) { | |
wp_enqueue_style( 'grappler-child-style', get_stylesheet_uri() ); | |
wp_enqueue_style( 'grappler-style', get_template_directory_uri() . '/output/style.css' ); | |
} else { | |
wp_enqueue_style( 'grappler-style', get_stylesheet_uri() ); | |
} | |
} | |
add_action( 'stylesheet_uri', 'grappler_stylesheet_uri', 10, 2 ); | |
function grappler_stylesheet_uri( $stylesheet_uri, $stylesheet_dir_uri ) { | |
if ( ! is_child_theme() ) { | |
$stylesheet_uri = $stylesheet_dir_uri . '/output/style.css'; | |
} | |
return $stylesheet_uri; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Assuming this code is happening the main [parent] theme:
Or, a simpler version:
Some notes:
output/style.css
at all here. Just stick the code in your mainstyle.css
.output/style.css
, using the filter would be preferred to me.style.css
should load second to override parent.