Digital experiences for all disciplines
New Landing › How can we help? › Cardinal › Cardinal: Child theme CSS vs Admin custom CSS
New Landing › How can we help? › Cardinal › Cardinal: Child theme CSS vs Admin custom CSS
- This topic has 29 replies, 3 voices, and was last updated 9 years by
Kyle – SUPPORT.
-
Posted in: Cardinal
-
November 10, 2014 at 6:44 pm #127117
I found this link:
Would it be possible to add a code snippet that would load the child theme css after the customizer and custom css outputs in the header?
In theory that should solve a lot of my issues or would it?
November 10, 2014 at 6:46 pm #127119Didn’t see that reply. I’ll try that how.
November 10, 2014 at 6:58 pm #127123Tried this with no luck unfortunately.
Using your code it loads the stylesheet just below responsive.css.
So that means WooCoommerce, customizer code, custom css etc is all loaded after it.
For testing, I changed the snippet from 100 to 1000 and it made little difference… just moved it down a few lines below redux-google-fonts-css
Any ideas?
November 10, 2014 at 7:50 pm #127126Try with 15, like in that article?
– Ed
November 10, 2014 at 7:56 pm #127127No use, 15 loads the stylesheet even higher up in the header.
November 10, 2014 at 11:07 pm #127159Hmm, annoying. Had a quick google and found this, give it a try:
add_action('wp_head','AB_late_css',1); function AB_late_css(){ $source = get_stylesheet_directory_uri().'/adjust_ABplugins.css'; wp_enqueue_style('adjust_ABplugins', $source); }
– Ed
November 10, 2014 at 11:35 pm #127162Tried that and doesn’t seem to do anything.
November 11, 2014 at 3:35 pm #127377Hmm ok.. The best way which I can think to do it is to do the first way I provided, and then use a plugin such as Better WordPress minify to adjust the order – but I’m guessing since you are running user sites that this isn’t too ideal?
I’ll keep looking.
– Ed
November 11, 2014 at 3:39 pm #127378Hey Ed,
No that wouldn’t be ideal for two reasons. The first as you said is that it would be running on user sites and the second one is that I am planning on using w3totalcache and from my testing, BWM does not work too well with that and/or is unncessary as W3 does BWM job anyway.
Hope you can find a solution. Working with a child theme is so convenient when dealing with a lot of code.
Thanks.
November 11, 2014 at 5:36 pm #127421Ok just tested this and it output below the custom css:
function custom_style_sheet() { wp_enqueue_style( 'custom-styling', get_stylesheet_directory_uri() . '/test.css' ); } add_action('wp_head', 'custom_style_sheet');
– Ed
November 11, 2014 at 8:11 pm #127466Thanks Ed,
I’ll try it out when I’m back at the computer.
November 11, 2014 at 8:19 pm #127469Just tested it, doesn’t work for me.
That code loads the custom css stylesheet in the footer and not before the closing </head>…
November 11, 2014 at 8:58 pm #127474Ahh yeah, that is odd.. Ok, this definitely works 100%.
function custom_style_sheet() { echo '<link rel="stylesheet" href="'.get_stylesheet_directory_uri() . '/test.css'.'" type="text/css" media="all" />'; } add_action('wp_head', 'custom_style_sheet', 100);
November 12, 2014 at 8:55 am #127528Seems to have done the trick.
Thanks Ed.
November 12, 2014 at 9:10 am #127535Great, thanks Ed
-
Posted in: Cardinal
You must be logged in and have valid license to reply to this topic.