Last active
August 29, 2015 14:04
-
-
Save cfxd/efa0a32739a0559ce56e to your computer and use it in GitHub Desktop.
Load the Contact Form 7 Stylesheet and JavaScript Only When Necessary (the Right Way). See http://cfxdesign.com/load-the-contact-form-7-stylesheet-and-javascript-only-when-necessary/
This file contains 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 do_action('cf7_before_wp_head'); ?> |
This file contains 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 | |
function remove_cf7_assets() { | |
if(is_front_page()) { | |
return; | |
} | |
add_filter('wpcf7_load_js', '__return_false'); | |
add_filter('wpcf7_load_css', '__return_false'); | |
} | |
add_action('cf7_before_wp_head', 'remove_cf7_assets'); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment