• Resolved max9003

    (@max9003)


    Hi everyone, friends!

    I need help. How to correctly insert a WPform into the modal window of another script on the WordPress website?

    I tried to simply place the shortcode in the simple WP format [wpforms id= “2810”] in the PHP code responsible for the output of the modal window for Callback, but instead of the desired form, in the modal window appeared only the shortcode itself.

    Please see the problem at the attached link – click on the Callback button in the lower right corner of the website and you will see the problem.

    The page I need help with: [log in to see the link]

Viewing 4 replies - 1 through 4 (of 4 total)
  • Hello @max9003,

    Thanks for writing in.

    If you are hardcoding the modal display through PHP and you want to use the WPForms shortcode, using the shortcode alone will not work. Instead, please use the do_shortcode WordPress function.

    Your code should look something like this:

    
    <?php echo do_shortcode('[wpforms id="2810"]'); ?>
    

    In case you would like to find more information about shortcodes in WordPress, please check here.

    I hope this helps!

    Thread Starter max9003

    (@max9003)

    Thank you for your help. I’ve already basically figured it out. It’s really necessary to use the shortcode output function via PHP <? php echo do_shortcode(‘[wpforms id= “2810”]’); ?>

    But there’s another problem: I inserted this PHP code <? php echo do_shortcode(‘[wpforms id= “2810”]’); ?> into the file responsible for displaying the modal window, but when the window opens, the WP form is displayed in it, but for some reason, it doesn’t work as it should.

    What do I mean by that:

    1) The message isn’t sent, the invisible Google ReCaptcha doesn’t work;

    2) For some reason, the submit-spin.svg icon is constantly spinning next to the form, which is located in the plugin folder /wpforms-lite/assets/images/submit-spin.svg

    At the same time, if I insert the php code <? php echo do_shortcode(‘[wpforms id= “2810”]’); ?> to any other place on the website, the form works fine – the message is sent, the invisible Google ReCaptcha works, there is no rotating submit-spin.svg icon next to the form.

    What could be the problem? Why does the form not work correctly only in the modal window?

    Hello @max9003,

    I checked and it looks like there are some JavaScript errors on your site.

    Here is a screenshot for reference. This could be affecting some functionalities of WPForms that rely on JavaScript.

    When you get the chance, could you please try using the steps in WPBeginner’s detailed guide on troubleshooting WordPress to see if it helps resolve the issue?

    Hi @max9003,

    We haven’t heard back from you in about a week, so I’m going to go ahead and close this thread for now. But if you’d like us to assist further, please feel welcome to continue the conversation.

    Thanks!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘How to insert WPforms in modal window?’ is closed to new replies.