WordPress.org

Support

Support » How-To and Troubleshooting » Contact Form 7 in sidebar

Contact Form 7 in sidebar

  • I am trying to put the contact form 7 in the sidebar of each of my pages. I thought I could just copy the code that is generated into a text widget and it would work. When I do this the contact form shows up but when I click send it just gets stuck with the arrows going around in a circle.

    Does anyone know how to get the contact form 7 to work inside the sidebar so it shows up on every page?

    Thanks!

Viewing 9 replies - 1 through 9 (of 9 total)
  • esmi

    @esmi

    Forum Moderator

    You would need to add the shortcode generated by Contact Form 7 to your sidebar’s template file. Mind you, I’ve not tried this myself so I’m not sure how well (or even if) it will work.

    Yes, I posted the generated contact form 7 code into a text widget. For example: [contact-form 1 “Contact form 1”]
    The form shows up in the side bar but when you click send all it does is show the arrows spinning, and never sends the email.

    esmi

    @esmi

    Forum Moderator

    So take it out of the text widget and add it manually to sidebar.php above (or below) the

    <?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar() ) : ?>
    [...]
    <?php endif; ?>

    code block.

    Do I need to put anything else besides the [contact-form 1 “Contact form 1”] in when I edit the sidebar? It is not working if I just paste it like that. I also tried <?php [contact-form 1 “Contact form 1”] ?> which didn’t work

    I’m also trying to get Contact Form 7 working in a text widget / sidebar. It currently works in FF/Safari etc but not IE…

    Is it possible? I’m not hugely experienced with php but I’d love to try a manual fix if someone could tell me the code to edit.

    esmi

    @esmi

    Forum Moderator

    @barbff: Sorry. Just realised that, since shortcodes are normally added as part of the_content(), some may rely on the standard content processing/parsing that is carried out on a post or page. Those same functions aren’t run on the sidebar content. So you could be completely out of luck. The only thing I can think of doing is to place the Contact Form shortcode in a temporary page or post, view the page source and copy the form markup. Then paste that markup into the sidebar. You won’t need any php tags but run a test on the form to make sure it still works.

    thanks you’re a genius! works for me….

    openfire9

    @openfire9

    I am trying to put the contact form 7 in the sidebar of each of my pages. I thought I could just copy the code that is generated into a text widget and it would work. When I do this the contact form shows up but when I click send it just gets stuck with the arrows going around in a circle.

    This is precisely the same problem I’m having trying to use the form in a text widget.

    It works fine in FF, just not in IE. Interestingly, it does work in IE when I’m not on the home page. It only hangs on the home page in IE.

    Is there any way to solve this with keeping it in a text widget?

    This worked for me:
    <?php echo do_shortcode('[contact-form 1 "Contact form 1"]'); ?>

    Hope this helps.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Contact Form 7 in sidebar’ is closed to new replies.
Skip to toolbar