Skip to content

Instantly share code, notes, and snippets.

@nosilver4u
Last active January 4, 2022 01:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nosilver4u/40783a3792e296e5af7c876ae5c3f454 to your computer and use it in GitHub Desktop.
Save nosilver4u/40783a3792e296e5af7c876ae5c3f454 to your computer and use it in GitHub Desktop.
Force the inclusion of CSS for certain elements within the Critical CSS function of SWIS Performance
<?php
/*
Plugin Name: SWIS Critical CSS Override
Version: 1.0.0
*/
add_filter( 'swis_generate_css_post_fields', 'swis_ccss_override_post_fields' );
function swis_ccss_override_post_fields( $fields ) {
if ( is_array( $fields ) ) {
$fields['forceInclude'] = array(
array( 'value' => '.wp-block-embed__wrapper' ),
array( 'value' => '.wp-block-cover' ),
array( 'value' => '.wp-block-cover-image' ),
);
}
return $fields;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment