Contact form below each post

Asked on December 3, 2015 in Customization.

Hi, I would like to put a contact form (I’ve got a embed code) under each post. So when someone reads a single page post he can directly use the contact form (or just a button to “contact”) from below the content of a post.Is there an option for that inside Layers or do I have to change a template file? If I have to change one, which one is it?

Thanks and cheers,

David

AliasNeo Layers User

I don’t know if I’m allowed to do this but here’s a solution I found:

With FTP I found the location of the content-single.php (php file that describes the layout of the single post page), then I edited the file so that I added the html href tag (with a link to my contact form) just after the content of the post and before the meta tags.

It works, and it looks great. I guess I’ll just need to redo it if I update LayersWP someday?

on December 4, 2015.
Reply
  • Possible Answers to Your Question:

  • 1 Answer(s)
    Answered on December 4, 2015.

    Hi there,

    Never modify your core Layers install templates, as those changes will be lsot when updating Layers. To do this with PHP you would need to create a child theme and write a custom function using a hook for wherever you want the code to appear. See the following primer for how this works:
    https://docs.layerswp.com/theming/

    The easier option is to simply embed the form into your posts and pages, If you are trying to avoid doing this every time, the best option is to put the form in your site footer so it is visible on every page. A plugin like Dynamic Widgets can help you limit the visibility to just single posts if you wish. I also recommend leveraging the built-in Comment system in WordPress, which is effectively a contact form on every post already. You can find several free plugins that allow you to customize the comment form to add new fields etc.

    Reply