How to get post title by contact form 7
Asked Answered
Z

3

6

I'm using contact form 7 in a website for get REQUEST QUOTE of each product.

Link to example

When visitor submit the REQUEST QUOTE form then I get a mail with desalts and want to get each single post title in that mail. I used [_post_title] code for get single post title and I got title. But I got only one post title from top of the page.

How I can get every single post title in the mail ?

Zolly answered 31/3, 2015 at 17:28 Comment(2)
I also had a similar requirement. What I did is, used jquery to write hidden input field to the form at runtime and set the value of post title got from get_the_title(); Think you got a hint on how you do itMillihenry
Can you give me code reference. PleaseZolly
L
32

Here you are,

  • [_remote_ip] This tag will be replaced by the sender’s client IP address.
  • [_user_agent] This tag will be replaced by the sender’s user agent information.
  • [_url] This tag will be replaced by the URL of the contact form.
  • [_date] This tag will be replaced by the date of the submission.
  • [_time] This tag will be replaced by the time of the submission.
  • [_post_id] This tag will be replaced by the ID of the post which contains the contact form.
  • [_post_name] This tag will be replaced by the name (slug) of the post which contains the contact form.
  • [_post_title] This tag will be replaced by the title of the post which contains the contact form.
  • [_post_url] This tag will be replaced by the permalink of the post which contains the contact form.
  • [_post_author] This tag will be replaced by the author name of the post which contains the contact form.

  • [_post_author_email] This tag will be replaced by the author email of the post which contains the contact form.

  • [_serial_number] This tag will be replaced by a numeric string whose value increments. Requires Flamingo 1.5+ be installed.

Hope them will help you, You can also see more here. See document for Contact Form 7 Get: post id, post title, post url,..and more

Lasalle answered 16/3, 2017 at 15:59 Comment(1)
The [_post_***] tags only work when the form is placed within the post content. If it's part of a sidebar then the fields will be blank.Hass
A
6

Install Contact Form 7 Dynamic Text Extension and use this code inside form In Form Tab of CF7

[dynamichidden unique-name "CF7_get_post_var key='title'"]
[dynamichidden page-url "CF7_URL"]

In Mail Tab :

To Output this data , you can use the tag [unique-name] in Subject or Message body in CF7 Mail tab

For Current Page title : [dynamichidden unique-name "CF7_get_post_var key='title'"]

For Current Page Link :
[dynamichidden page-url "CF7_URL"]

Austro answered 1/6, 2020 at 15:3 Comment(0)
A
0

Use [ss_post_title] to show your post title in mail content, and write a script in your template file or header/footer.

$(document).ready(function(){
   $('.ss_post_title').hide();
   $('.applt').on('click',function()
   {
       var ttlpost = $('.panel-heading.active span.posttitl').text();
       $('.ss_post_title input').val(ttlpost);
   });
});

Please use classes according to your code.

Avunculate answered 23/2, 2018 at 7:33 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.