• Resolved Nikolar91

    (@nikolar91)


    I read the documentation and looked online and I just don’t get it. Please can someone explain to me in step-by-step simple terms? I have a custom post type, and in the single post template, I have a signup form. I want to get a post name in the subject of an email.
    I tried using the native CF7 special mail tag [_post_title], the form works but it just doesn’t want to use the special mail tags it just sends blanks. I found on forums that people suggest using Contact Form 7 – Dynamic Text Extension but I struggle to understand how to use it. I don’t get where to put what tag and where to use single quotes. Please can someone explain to me in step-by-step simple terms how to achieve this?

Viewing 1 replies (of 1 total)
  • Plugin Author Tessa (they/them), AuRise Creative

    (@tessawatkinsllc)

    I’d love to help you ??

    To get the current post title, you’ll want to use the CF7_get_post_var shortcode with the post_title key. Let’s say you want to name your field subject_line, so this is what it’d look like in your form to create the field:

    [dynamictext subject_line "CF7_get_post_var key='post_title'"]

    That goes in your form template along with your other fields like first name, last name, email address, etc.

    Save your form, then go to the “Mail” tab where you should see [subject_line] across the top as available mail tags. In the subject line of the mail form, put that there, brackets and all. The text “subject_line” here matches the input’s name on the form.

    Now when you view the page that has your form, you should see that field already populated with that post’s title.

    If you want the field to be visible but not editable, you can make it readonly by adding that attribute to the form tag like this:

    [dynamictext subject_line readonly "CF7_get_post_var key='post_title'"]

    And if you don’t want that field to be visible at all, you can make it a hidden field like this:

    [dynamichidden subject_line "CF7_get_post_var key='post_title'"]
Viewing 1 replies (of 1 total)
  • The topic ‘How to get custom post title in mail subject’ is closed to new replies.