• Resolved leop21

    (@leop21)


    Hello,

    I created a post type called a consortium, I put the contact form 7 shortcode in single-consorcio.php, it is listed in all registered products. In the email, I need to be sent to the url and the name of the registered product, so I used it.

    [_post_title]
    [Url]

    Only [url] worked, [_post_title] arrives in the email just as it was filled, how do I enter the product title in the email?

    Follow the prints.

    1 – Single-consorcio.php

    Single

    2 – Code insert in contact form 7 email tab

    Email tab

    3 – E-mail received

    Email received

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Takayuki Miyoshi

    (@takayukister)

    See Special Mail Tags

    Note that the [_post_*] tag has value only when you put the contact form into content of a post or a page.

    This is applicable to a custom post type as well.

    Thread Starter leop21

    (@leop21)

    Hello, Takayuki

    I put the [_post_title] tag inside the single.php file, should it not work?

    Plugin Author Takayuki Miyoshi

    (@takayukister)

    [_post_title] is a mail-tag. It doesn’t work in a template file.

    Thread Starter leop21

    (@leop21)

    Thanks, Mr Takayuki

    @leop21
    in CF7 form add hidden field:
    [hidden pagename "PAGE_NAME"]

    in template:

    $form = do_shortcode('[contact-form-7 id="123" title="blah blah"]');
    $form = str_replace("PAGE_NAME", $post->post_title, $form);
    echo $form;
    • This reply was modified 7 years, 7 months ago by sohaus.
Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘[_post_title] does not work in post type’ is closed to new replies.