Adding a contact form to all posts

  • Unknown's avatar

    I’ve looked through the comments and have not seen this one addressed.

    I know how to add a contact form to a post. Is there a way to add a contact form to all posts at once or do you have to do it one by one?

    Many thanks.

    The blog I need help with is: (visible only to logged in users)

  • Hi there,

    Unless you’re on a Business Plan, you would have to do it one by one if you are wanting a contact form directly underneath every post of your site.

    If your site was self hosted (using the WordPress.org software but hosted elsewhere) you would be able to create a function that can be added to your sites child theme / custom theme functions.php or single.php files which would add a contact form to the end of every post on your site. Since your site is hosted here at WordPress.com, you wouldn’t be able to access your theme template files to make modifications.

    You could add a plugin, if you have the Business Plan, that would add a widget at the bottom of each blog post, and add the contact form into this widget (something such as Add Widget After Content would work).

    An alternative way around this is to add a contact form to your footer widget area, or into a sidebar widget area, and make sure it’s visibility is set so that it will only show up on pages with posts. If you are using the original dashboard, you’d do this by accessing Widgets underneath Appearance in the main menu, then adding a Custom HTML widget where you’d input your form code. In the new editor you’d access the Widgets by clicking on Customize next to Themes in the My Sites tab, and then clicking on Widgets.

    When you add a contact form to a blog post using the default contact form (by clicking the Add button above the post), or in the original dashboard (using the contact form button), you can copy the code that is outputted in the HTML editor. This same code can go in a Custom HTML widget.

    Setting the visibility so that the forms only show up in sidebars or footer widgets on blog pages would just involve clicking on the Visibility button for that widget, and choosing ‘show if page is (post type:) post’.

    It may not be exactly what you are looking for, but could be a possible work-around.

  • Unknown's avatar

    Thank you for the detailed response, Karen.

  • You’re welcome, hope it helps.

  • Hi there,

    Why do you want a contact form on each post? A contact form is intended as a way to allow people to contact you privately – contact form submissions do not appear as comments on the post, and in fact are in no way connected to any specific post or page on your site. Most people use a dedicated contact page on their site for a contact form, or you can add it in a widget if you want it visible on all pages on the site, but it’s very unusual to have more than one form on a site unless you use different forms for different purposes routing to different email addresses.

    If you want a form at the bottom of each post where people can respond to the post, you don’t need a contact form, but instead need to enable comments. You do this directly from the post editor, though you can set comments on or off by default under My Site ->Settings ->Discussion.

    Enable or Disable Comments

    Also note that as a Premium Plan owner you can get help with questions like these via live chat support via our support contact form. You don’t need to post in the public forums:

    https://wordpress.com/help/contact

  • Unknown's avatar

    Thank you, Kokkieh. I wasn’t committed to the idea (in large part for the reasons you mention) but was curious. I have a Contact page set up. I will also look at adding a contact form as a widget in one of the footers.

    I did not know about the live chat support. Thanks for the tip. I’ll use it going forward for questions like this.

  • Nothing wrong with curiosity. In that case, though, you’d need to edit each post individually, as the contact form code needs to be added to the actual post content. On a self-hosted WordPress installation or a Business Plan site you’d likely be able to do it with a plugin or by modifying the theme itself.

    You’re of course still welcome to post here if you prefer, but you do have access to live chat and it tends to be faster than waiting for a forum reply :)

  • The topic ‘Adding a contact form to all posts’ is closed to new replies.