Last active
August 29, 2015 14:13
-
-
Save aj-adl/5f5e318a97874180ebba to your computer and use it in GitHub Desktop.
Removes Contact Form 7 Styles and Scripts Except on the 'Contact Us' page
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Make sure you only use opening / closing tags if needed!!! | |
// Removes Contact Form 7 scripts and Styles except on contact-us page | |
add_action( 'wp', 'BSHP_cf7_conditionally_load_assets_simple' ); | |
// returns false, used for setting filters to false | |
function return_false() { | |
return false; | |
} | |
function BSHP_cf7_conditionally_load_assets_simple() { | |
// Any Number of conditional statments can go here ( using || for OR, && for AND ) | |
if ( !is_page( 'contact-us') ) { | |
add_filter( 'wpcf7_load_css', 'return_false' ); | |
add_filter( 'wpcf7_load_js', 'return_false' ); | |
} | |
} | |
// Make sure you only use opening / closing tags if needed!!! | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment