AO by default injects the autoptimized CSS before the title-tag, but you can force AO to do otherwise by hooking into the API, e.g. this small code snippet which lets AO inject before the closing head-tag;
add_filter('autoptimize_filter_css_replacetag','luicscmas_css_replacetag',10,1);
function luicscmas_css_replacetag($replacetag) {
return array("</head>","before");
}
the first element of the array is the HTML-tag to look for, the second one is one of “before”, “after” or “replace”.
hope this helps,
frank
Thanks!!!
I’ll give it a try.
I checked a prior version of the theme and WordPress and the /wp-content/themes/bridge/css/style_dynamic.php was “removed” from optimized version:
WordPress 4.8.4 and old version of theme (BridgeVersión 11.0)
view-source:http://mvets.aititubi.es/
view-source:http://mvets.aititubi.es/?ao_noptimize=1
Which could be the reason for the behaviour change?
Thanks in advance!!!
I checked a prior version of the theme and WordPress and the /wp-content/themes/bridge/css/style_dynamic.php was “removed” from optimized version:
AO never aggregates/ optimizes CSS (or JS) that is served through PHP, but when looking at the un-optimized HTML source, these are not dynamic PHP but static CSS files:
<link rel='stylesheet' id='style_dynamic-css' href='http://mvets.aititubi.es/wp-content/themes/bridge/css/style_dynamic.css?ver=1515497301' type='text/css' media='all' />
As such they are removed (as in aggregated & optimized) by AO.
frank
Ok thanks, so that’s why changed the behavior… in the prior version, it was a style_dynamic.css and now it’s a style_dynamic.php…
I’ll contact the Theme Authors then!
Thank you