• jen697

    (@jen697)


    Hello,

    I have a contact form loading on a custom post type called Portfolio which was created by my theme. When I try to use the special mail tags [_post_title] and [_post_url] in the contact email they don’t work.

    Is there a way I can get the special mail tags to work?

    Thanks!

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

    (@takayukister)

    See Special Mail Tags

    It works if you insert the [contact-form-7 …] shortcode into a post content of the CPT. If you use the shortcode in a theme template, place it inside the loop.

    Thread Starter jen697

    (@jen697)

    Hello,

    Yes, I am using the [contact-form-7 …] shortcode to display the form. That works fine and is not the problem.

    The issue is that in the email that I receive when someone submits the contact form, I have added the shortcodes to display the post URL and post title and those do not work. Instead of displaying the proper data in the email I receive, it displays the shortcode.

    The same form and email works properly on regular pages, but does not work on the custom post type.

    • This reply was modified 6 years, 12 months ago by jen697.
    Thread Starter jen697

    (@jen697)

    Hi, I’m still waiting on a reply for this… Thanks!

    I’m also looking for this.

    i solved this problem with jQuery:
    I have post type PRODUCTS and i load my CTP7 by shortcode in single-products.php

    The first, i get the title of products page:

    $title = get_the_title();

    <h2 dataTitle=”<?php echo $title; ?>”><?php echo $title; ?></h2>

    Next, in admin panel of my form, i create 1 text field to get my title products, and dont show in front end

    <div style=”display: none”>[text title_product id:title_product placeholder "Title"]</div>

    I used a little bit jquery to fill title to my text field when load page:
    $(document).ready(function(){
    var title = $(‘h2’).attr(‘dataTitle’);
    $(“input#title_product”).val(title);
    });

    in message body of form, i call my title of page
    [title_product]

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Special Mail Tags for Custom Post Type’ is closed to new replies.