Quantcast
Channel: WordPress.org Forums » [Autoptimize] Support
Viewing all articles
Browse latest Browse all 14038

Frank Goossens on "[Plugin: Autoptimize] Using inline and defer API override global per page"

$
0
0

yeah, probably the error that's messing things up, that'll teach me to just put untested code up on the forum ;-)

so try with this untested snippet;

add_filter('autoptimize_filter_css_defer_inline','my_ao_css_defer_inline',10,1);
function my_ao_css_defer_inline($inlined) {
	if (strpos($_SERVER['REQUEST_URI'],'/how-it-works/')!==false) {
		return "h2,h1{color:red !important;}";
	} elseif (strpos($_SERVER['REQUEST_URI'],'/other-url/')!==false) {
		return "h2,h1{color:blue !important;}";
	} else {
		return $inlined;
	}
}

frank


Viewing all articles
Browse latest Browse all 14038

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>