• I am trying to get a contact form to work in a single template of my site. I have looked through many examples of plugins and code but am unsure which, if any, offer what i am asking.
    I would like to put a conctact form into the ‘single.php‘ page so that each post has it’s own contact form which is not visible when only in a ‘category‘ or ‘archive‘ featuring that post. So when the user views the full article alone they will have the contact form added. To complete this plan i would also like the email produced by the contact form to indicate from what post the mail was originated.
    I would be very grateful if somebody could tell me if and how this is possible. Thanks.

Viewing 4 replies - 1 through 4 (of 4 total)
  • I would be very grateful if somebody could tell me if and how this is possible.

    1. yes, it’s possible

    2. edit single.php

    I would like to put a conctact form into the ‘single.php’ page so that each post has it’s own contact form which is not visible when only in a ‘category’ or ‘archive’ featuring that post.

    This is a confusing sentence, as single.php has nothing to do with categories or archives. single.php is your single post page — your permalink page.

    IF you utilize them, category.php and archive.php control what those other pages look like.

    Thread Starter olczak

    (@olczak)

    hi. thanks whooami. i have my site arranged so that posts are first viewed by a user selecting a ‘category’ page. when they click on a link in the post viewed in the ‘category’ (or ‘archive’) page they are taken to a page with only that article plus a contact form (templated by the single.php). as users view the whole article already in the category section, the single page becomes utilised as a contact page. and if i can specify what the title of the post is, in that email sent, then it becomes a useful tool in users responding to individual posts.

    i am not trying to set up a normal blog and do not want to make use of comments.
    so you say i need to edit the single.php – do you have any ideas of what i should put into it?
    thanks

    Check out my site: http://www.cssdesigned.com/

    I used a contact form in the left side which is inside a template. I used this plugin:

    http://www.deliciousdays.com/cforms-plugin

    It has a ton of features and is very easy to configure using the admin interface. Or another way (which would work well under your site setup) would be to surround the contact form using conditional tags:

    <?php if (is_single())
    {
    
    --> contact form <--
    
    }?>

    so you say i need to edit the single.php – do you have any ideas of what i should put into it?

    yes, you put a contact form in it..

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Can you put a contact form in a template?’ is closed to new replies.