Support » Fixing WordPress » [Plugin: Contact Form 7] Any way to fetch a post title to a contact form?

  • 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?


Viewing 11 replies - 1 through 11 (of 11 total)
  • 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(); ?>.

    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?

    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.


    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…

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

    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.

    		$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 ?

    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…

    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.

    Any other solutions here? (Besides switching to cform)

    i would be interested into this as well

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

    or just contact me on ICQ 463255313

    Hi guys

    This solved the problem for me!

    Good luck!

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘[Plugin: Contact Form 7] Any way to fetch a post title to a contact form?’ is closed to new replies.