WordPress.org

Ready to get started?Download WordPress

Forums

[Plugin: Contact Form 7] Any way to fetch a post title to a contact form? (12 posts)

  1. WhiteKnightProjects
    Member
    Posted 5 years ago #

    Hi,

    I woul dlike to use this plugin to receive 'quote requests' from people and would love a way to grab the wordpress post title and automatically add it to the contact form. Anyone know if this is possible?

    Thanks,

  2. thelastknight
    Member
    Posted 5 years ago #

    If I remember right, Contact Form 7 has to be used in a post. So when the post containing the contact form is displayed (which will be single.php) just use <?php the_title(); ?>.

  3. WhiteKnightProjects
    Member
    Posted 5 years ago #

    Thanks for the idea but that's not quite the way I was hoping to get it to work - although I may have to resort to it.

    I'd like to be able to enter a 'quote me' button/image/link on every post and when users click it, they get taken to a generic 'quote page' (contact page) and then the contact form somehow prefills the post title from the referrer to the form, so that I know what quote my users are requesting...

    Do you have any workarounds along those lines?

  4. WhiteKnightProjects
    Member
    Posted 5 years ago #

    Ive been giving this some thought and I have managed to get to the stage where simply sending the post title in the form will be sufficient.

    So if there is a way to include <?php the_title(); ?> in the form somewhere then this will work.

    The objective is for the admin to receive the email from the site (via CF 7) but to know which product the user was requesting information on.

    I'd be grateful for any help.

    Thanks,

  5. jaslr
    Member
    Posted 5 years ago #

    I too would like a response to this.

    I have built a website around WordPress and installed the Contact Form 7 at the base of each page (not post). I would like to know what page the user sent the enquiry from...

  6. gegenalles
    Member
    Posted 5 years ago #

    I'm also looking for a way to do this.

    But if you simply add "the_title()" to your e-mail, the email text would always be the title of your contact form - page, not the title of the referral post.

    My approach was to do it with a hidden field, that contains a php-variable:
    I've got one contact-form-page.
    I access it via "http://myblog.com/contact-form?myreferral=1".

    myreferral is the ID of the referral post.

    I've found a way to insert this variable as a hidden field into the contact form.

    But that hidden field is not mailed.

    $fcinteresting=$_GET['xyz'];
    
    		$form .= '<form action="' . $url . '" method="post" class="wpcf7-form"' . $enctype . '>';
            $form .= '<div style="display: none;">';
    		$form .= '<input type="hidden" name="_wpcf7" value="' . $id . '" />';
    		$form .= '<input type="hidden" name="_wpcf7_version" value="' . wpcf7_version() . '" />';
    		$form .= '<input type="hidden" name="_wpcf7_unit_tag" value="' . $unit_tag . '" />';
    		$form .= '<input type="hidden" name="interesting" value="' . $fcinteresting . '" />';

    This is where I inserted the hidden field "interesting".

    The field appears in the form markup, but it isn't included in the mail.

    Any idea ?

  7. jaslr
    Member
    Posted 5 years ago #

    I am still looking for a solution for this. I would love a checkbox inside the admin screens for Contact Form 7 that simply said, "Insert page ID as custom field".

    That would solve everything for me...

  8. WhiteKnightProjects
    Member
    Posted 5 years ago #

    I had to switch to cforms 10 to get the desired affect. It actually has a setting built in that allows you to include the post title in the subject line of the email.

    It was not ideal but it served my purpose.

  9. jaslr
    Member
    Posted 5 years ago #

    Any other solutions here? (Besides switching to cform)

  10. timoxxl
    Member
    Posted 5 years ago #

    i would be interested into this as well

  11. timoxxl
    Member
    Posted 5 years ago #

    hi Takayuki would be really great to get an reply on this.

    or just contact me on ICQ 463255313

  12. Screaminchief
    Member
    Posted 4 years ago #

    Hi guys

    This solved the problem for me!

    http://wordpress.org/support/topic/308003?replies=7#post-1226523

    Good luck!

Topic Closed

This topic has been closed to new replies.

About this Topic