Skip to content

Instantly share code, notes, and snippets.

@glueckpress
Created December 15, 2017 14:55
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save glueckpress/9fbc1a03a0525e48a60bde22b892dd44 to your computer and use it in GitHub Desktop.
Save glueckpress/9fbc1a03a0525e48a60bde22b892dd44 to your computer and use it in GitHub Desktop.
[WordPress][WP Rocket] As of 2.11, WP Rocket generates critical CSS automatically. Here’s how to adjust parameters for maximum viewport width and height.
<?php
/**
* Customise parameters for critical CSS generator.
*/
add_filter( 'rocket_cpcss_job_request', function ( $item ) {
return array(
'url' => $item['url'],
'mobile' => 0, // 1 = Emulate a mobile device
'viewport_width' => 1300 // px maximum width of the viewport
'viewport_height' => 900 // px maximum height of the viewport
);
}, 10, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment