Snippets: Conditionally Disable Responsiveness

Make sure to change 'PAGE_ID' with the ID of the page where you want to disable responsiveness or change the entire is_page() conditional for your own conditional checks.

// Remove theme responsiveness
function myprefix_remove_theme_responsive_css() {
	if ( is_page( 'PAGE_ID' ) ) {
		wp_deregister_style( 'wpex-responsive' );
		wp_dequeue_style( 'wpex-responsive' );
	}
}
add_action( 'wp_enqueue_scripts', 'myprefix_remove_theme_responsive_css', 9999 );

// Remove VC responsiveness
function myprefix_remove_vc_responsive_css( $classes ) {
	if ( is_page( 'PAGE_ID' ) ) {
		$classes[] = 'vc_non_responsive';
		$classes = array_diff( $classes, array( 'vc_responsive' ) );
	}
	return $classes;
}
add_action( 'body_class', 'myprefix_remove_vc_responsive_css', 9999 );

Snippet Type: PHP

Posted Under: Mobile

All PHP snippets should be added via a child theme's functions.php file.