Forked from ericrasch/functions - deregister contact form 7 css and js.php
Created
October 7, 2013 23:51
-
-
Save eduard-un/6877057 to your computer and use it in GitHub Desktop.
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
/* =BEGIN: Only include Contact Form 7 javascript and CSS when needed | |
Source: http://fredrikmalmgren.com/only-include-contact-form-7-javascript-and-css-when-needed/ | |
---------------------------------------------------------------------------------------------------- */ | |
add_action( 'wp_print_scripts', 'deregister_cf7_javascript', 100 ); | |
function deregister_cf7_javascript() { | |
if ( !is_page('contact') ) { | |
wp_deregister_script( 'contact-form-7' ); | |
} | |
} | |
add_action( 'wp_print_styles', 'deregister_cf7_styles', 100 ); | |
function deregister_cf7_styles() { | |
if ( !is_page('contact') ) { | |
wp_deregister_style( 'contact-form-7' ); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment