Community Forums › Forums › General Discussion › Adding child style sheet *after* main style sheet
Tagged: stylesheet
This topic contains 6 replies, has 3 voices, and was last updated by armadillo 3 months, 3 weeks ago.
-
AuthorPosts
-
January 10, 2013 at 5:17 am #10907
I’m using Genesis 1.9.1.
I have a slightly customized theme. I add css to a child_styles.css file to override the standard styles.css file in the base child theme files.
I add my new style sheet using:
add_action('get_header', 'child_load_styles');
function child_load_styles() {
wp_enqueue_style('child_style_css', CHILD_URL . 'child_styles.css');
}
However, this puts my child_styles sheet above the styles sheet in the rendered HTML.
I see a note about 1.9.1 that suggests the update is related to this – it was working before the update. But, I’m not sure what I have to change to get my child sheet loaded after the standard sheet.
Any advice?
January 11, 2013 at 9:13 pm #11394January 14, 2013 at 4:55 am #11782I’m trying to keep my changes separate so I can use any updated child themes. My theme is only lightly customized.
January 14, 2013 at 5:25 am #11788January 16, 2013 at 8:54 pm #12544Bill’s right, but you probably want to add a priority to guarantee it comes after.
add_action( 'wp_enqueue_scripts', 'child_load_styles', 99 );
function child_load_styles() {
wp_enqueue_style('child_style_css', CHILD_URL . 'child_styles.css');
}
January 16, 2013 at 10:11 pm #12558@Travis – Per this, isn’t the default priority on the main child theme stylesheet = 5? Adding the action without specifying a priority uses the default of 10, and since 10 is later than 5, is specifying a priority really helpful? If so, how so?
Twitter: @wpperform
January 22, 2013 at 4:57 pm #13891Adding the action to wp_enqueue_scripts worked great. Thanks!
-
AuthorPosts
You must be logged in to reply to this topic.