I have a issue in loading of contact form 7 in wordpress site

4.2k views Asked by At

when I click on send button it is loaded complete page but I want load only contact us form.If u know better way to do it...Please tell me.

1

There are 1 answers

0
WP_boss On

It's depend on yous CSS and JS...For do it successfully you should follow these step's.

Step 1: Stop loading the JavaScript and CSS stylesheet on all pages

When the value of WPCF7_LOAD_JS is set to false (default: true), Contact Form 7 does not load the JavaScript. You can set the value of this constant in your wp-config.php like this:

define('WPCF7_LOAD_JS', false);

Likewise, you can control the loading of the CSS stylesheet with WPCF7_LOAD_CSS. Contact Form 7 does not load the CSS stylesheet when the value of WPCF7_LOAD_CSS is false (default: true). You can set it in the wp-config.php like this:

define('WPCF7_LOAD_CSS', false);

Or, if you’re using Contact Form 7 3.9 or higher, you can also disable the loading of the JavaScript and CSS by adding a few lines of code into your theme’s functions.php file, like this:

add_filter( 'wpcf7_load_js', '__return_false' );
add_filter( 'wpcf7_load_css', '__return_false' );

Step 2: Load the files on pages which contain contact forms

let’s say you have a page named “example.php” and it is the only page that contains a contact form. You must edit the ‘example.php’ template file and insert the following lines (put upon side of short code of contact form)into it:

<?php
if ( function_exists( 'wpcf7_enqueue_scripts' ) ) {
    wpcf7_enqueue_scripts();
}

if ( function_exists( 'wpcf7_enqueue_styles' ) ) {
    wpcf7_enqueue_styles();
}

?>

Now you should refresh your page and click on send button it'll work correctly. Thank's.