WordPress.org

Ready to get started?Download WordPress

Forums

Can you put a contact form in a template? (5 posts)

  1. Olczak
    Member
    Posted 6 years ago #

    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.

  2. whooami
    Member
    Posted 6 years ago #

    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.

  3. Olczak
    Member
    Posted 6 years ago #

    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

  4. basketball
    Member
    Posted 6 years ago #

    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 <--
    
    }?>
  5. whooami
    Member
    Posted 6 years ago #

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

Topic Closed

This topic has been closed to new replies.

About this Topic