New plugin
We have published a new plugin for Critical CSS optimization. It is advised to use our new plugin for access to the latest technologies and long term support.
Install new plugin
Critical Path CSS is the minimum CSS required to render above the fold content. Please read the documentation by Google before you continue.
This article by a Google engineer provides information about the available methods for creating critical path CSS. This blog (with video) by two Google engineers provides information about the essence of Critical Path CSS creation.
Custom Critical CSS Condition
You can add a custom critical CSS condition using a filter function. For example, if you want to add critical CSS for blog category X, you can use the following filter function.
/**
* Custom Critical Path CSS Condition
*
* @plugin Above The Fold Optimization
* @link https://wordpress.org/plugins/above-the-fold-optimization/
*/
function my_critical_css_condition( $params = array() ) {
// Category X?
if (is_category('x')) {
return true; // match
}
return false; // no match
}
To add the condtion to a critical CSS file, type filter:my_critical_css_condition in the condition search field. You can add a comma separated list with JSON encoded values to be passed to the filter $params by appending :1,2,3,"variable","var". The filter function should return true or false.