Created
July 21, 2017 22:29
-
-
Save DreamerKlim/dc46f0fad0a56fa3025317d7674bb245 to your computer and use it in GitHub Desktop.
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
/* -------------------------------------------------------------------------- | |
* Удаляем вывод стилей и скриптов от модуля Contact Form 7, где он не используется | |
* -------------------------------------------------------------------------- */ | |
// Deregister Contact Form 7 styles | |
add_action( 'wp_print_styles', 'aa_deregister_styles', 100 ); | |
function aa_deregister_styles() { | |
if ( ! is_page( get_theme_mod( "header_contacts") ) ) { | |
wp_deregister_style( 'contact-form-7' ); | |
} | |
} | |
// Deregister Contact Form 7 JavaScript files on all pages without a form | |
add_action( 'wp_print_scripts', 'aa_deregister_javascript', 100 ); | |
function aa_deregister_javascript() { | |
if ( ! is_page( get_theme_mod( "header_contacts") ) ) { | |
wp_deregister_script( 'contact-form-7' ); | |
} | |
} | |
/* -------------------------------------------------------------------------- | |
* Удаляем вывод стилей и скриптов от модуля Contact Form 7, где он не используется. | |
* -------------------------------------------------------------------------- */ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment