WordPress.org

Ready to get started?Download WordPress

Forums

Contact Form 7 in sidebar (10 posts)

  1. barbff
    Member
    Posted 5 years ago #

    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!

  2. esmi
    Forum Moderator
    Posted 5 years ago #

    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.

  3. barbff
    Member
    Posted 5 years ago #

    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.

  4. esmi
    Forum Moderator
    Posted 5 years ago #

    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.

  5. barbff
    Member
    Posted 5 years ago #

    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

  6. pace_of_one
    Member
    Posted 5 years ago #

    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.

  7. esmi
    Forum Moderator
    Posted 5 years ago #

    @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.

  8. pace_of_one
    Member
    Posted 5 years ago #

    thanks you're a genius! works for me....

  9. openfire9
    Member
    Posted 4 years ago #

    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?

  10. bento
    Member
    Posted 4 years ago #

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

    Hope this helps.

Topic Closed

This topic has been closed to new replies.

About this Topic