Tagged: !important, child, child theme, custom styles, custom.css, order
-
AuthorPosts
-
September 3, 2013 at 11:47 pm #28934
This thread was the closest I saw: https://kriesi.at/support/topic/issue-with-child-theme
But, my enfold functions.php code seems to be slightly different.
//register styles
wp_register_style( 'avia-style' , $child_theme_url."/style.css", array(), '1', 'screen' ); //register default style.css file. only include in childthemes. has no purpose in main theme
wp_register_style( 'avia-grid' , $template_url."/css/grid.css", array(), '1', 'screen' );
wp_register_style( 'avia-base' , $template_url."/css/base.css", array(), '1', 'screen' );
wp_register_style( 'avia-layout', $template_url."/css/layout.css", array(), '1', 'screen' );
wp_register_style( 'avia-scs', $template_url."/css/shortcodes.css", array(), '1', 'screen' );
wp_register_style( 'avia-custom', $template_url."/css/custom.css", array(), '1', 'screen' );
wp_register_style( 'avia-prettyP', $template_url."/js/prettyPhoto/css/prettyPhoto.css", array(), '1', 'screen' );
wp_register_style( 'avia-media' , $template_url."/js/mediaelement/skin-1/mediaelementplayer.css", array(), '1', 'screen' );
//register styles
wp_enqueue_style( 'avia-grid');
wp_enqueue_style( 'avia-base');
wp_enqueue_style( 'avia-layout');
wp_enqueue_style( 'avia-scs');
wp_enqueue_style( 'avia-prettyP');
wp_enqueue_style( 'avia-media');Which I changed, as an educated guess to:
//register styles
wp_register_style( 'avia-grid' , $template_url."/css/grid.css", array(), '1', 'screen' );
wp_register_style( 'avia-base' , $template_url."/css/base.css", array(), '1', 'screen' );
wp_register_style( 'avia-layout', $template_url."/css/layout.css", array(), '1', 'screen' );
wp_register_style( 'avia-scs', $template_url."/css/shortcodes.css", array(), '1', 'screen' );
wp_register_style( 'avia-custom', $template_url."/css/custom.css", array(), '1', 'screen' );
wp_register_style( 'avia-prettyP', $template_url."/js/prettyPhoto/css/prettyPhoto.css", array(), '1', 'screen' );
wp_register_style( 'avia-media' , $template_url."/js/mediaelement/skin-1/mediaelementplayer.css", array(), '1', 'screen' );
wp_register_style( 'avia-style' , $child_theme_url."/style.css", array(), '1', 'screen' ); //register default style.css file. only include in childthemes. has no purpose in main theme
//register styles
wp_enqueue_style( 'avia-grid');
wp_enqueue_style( 'avia-base');
wp_enqueue_style( 'avia-layout');
wp_enqueue_style( 'avia-scs');
wp_enqueue_style( 'avia-prettyP');
wp_enqueue_style( 'avia-media');Is this effectively the same thing? Just needing to change the order in which the child theme is called? I can’t wait to get rid of all the !important tags.
Thanks and great theme!
September 4, 2013 at 1:21 am #139200Hi jguerrero01,
As of Enfold 2.0 you shouldn’t need to modify the functions file to get the child theme style coming at the end. I just did a quick test of it creating a new child theme on my live install and it properly spits out the child theme style.css last.
Changing the order of wp_register_style doesn’t change the output order. That is determined by the wp_enqueue_style which has the if statement at the end now.
Regards,
Devin
September 4, 2013 at 7:02 pm #139201Thanks Devin!
I will try creating a new (copied) child theme, perhaps this was started on an older version or something. Thanks!
One question, what are the different uses between custom.css and style.css? Do they both accomplish the same thing?
September 4, 2013 at 7:07 pm #139202Hi,
No, they don’t, style.css is the file that tells WordPress the theme name, the author, version, etc. and shouldn’t be edited, on the contrary custom.css is a file that you can edit without affecting the core functionality of the theme.
Regards,
Josue
-
AuthorPosts
- The topic ‘Child Theme Custom CSS Order’ is closed to new replies.