How can I surpress / turn off the contact form for only one(or selected) pages?
-
I have need to build out some pages that I just don’t want the contact form to pop up on. I also tried to use an iframe of one of my pages and the contact form is there at the bottom, good, bad, or indifferent.
I found this code below and was wondering, if I knew the name of the jscript, would this work for our form?Thanks
– MannyI found this code on a site: https://www.slickrockweb.com/excluding-wordpress-plugin-helper-files.php
Excluding Plugin Related File on Certain WordPress Page
September 18th, 2013By adding code snippets to your themes functions.php file you can remove the javascript and CSS from all pages that don’t use that particular wordpress plugin which makes your site load faster.
<<<Here is an example for the Contact 7 form wordpress plugin. This snippet removes the JS files.>>>
add_action( ‘wp_print_scripts’, ‘deregister_cf7_javascript’, 100 );
function deregister_cf7_javascript() {
if ( !is_page(100) ) {
wp_deregister_script( ‘contact-form-7’ );
}
}<<<Remove Contact 7 css files>>>
add_action( ‘wp_print_styles’, ‘deregister_cf7_styles’, 100 );
function deregister_cf7_styles() {
if ( !is_page(100) ) {
wp_deregister_style( ‘contact-form-7’ );
}
}
- The topic ‘How can I surpress / turn off the contact form for only one(or selected) pages?’ is closed to new replies.