• I have been working with contact form 7 for a while now, and i usually face this issue when i create a custom footer on my client’s website. I’m working on a project now and i used a custom footer structure, registering Widgets and using the widget to load the contents in which Contact form 7 shortcode is added to one of the widget. I then noticed that the contact form 7 CSS and JS is never loaded, which makes the contact form reload page with this URL structure.

    I search online and found this page (Loading JavaScript and Stylesheet Only When it is Necessary) which explains how to enqueue and dequeue contact form 7 and what i did was to add the following code on that template loading the widget that handles that contact form 7 shortcode.

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

    The reason i asked this question is to know why contact form 7; when added using shortcode outside of wordpress content area, would work via ajax unless you do the method above or add a dummy contact from on the page and hide that dummy contact form.

    Will really appreciate some info on this.

    Thanks

    • This topic was modified 5 years, 3 months ago by isabelk2j.
    • This topic was modified 5 years, 3 months ago by Jan Dembowski. Reason: Formatting
  • The topic ‘Contact form 7 not doing Ajax if Shortcode is used’ is closed to new replies.