【问题标题】:Include shortcode within contact form 7在联系表格 7 中包含简码
【发布时间】:2018-12-12 23:43:54
【问题描述】:

使用联系表格 7,当客户填写表格时,它会向我发送一封电子邮件,其中包含客户输入的数据。在这封电子邮件中,我想包含我在网站上使用的短代码。

我使用的简码只显示一些文本,并在网站上正常工作。

但是,如果我将它添加到联系表单电子邮件中,它不会显示简码的内容,它只是将简码显示为文本... [buf_reg]

是否可以在联系表格 7 电子邮件中显示短代码?或任何其他电子邮件?

【问题讨论】:

    标签: wordpress shortcode contact-form-7


    【解决方案1】:

    在你的functions.php中尝试这个sn-p代码,让简码在Contact Forms 7发送的电子邮件中工作:

    add_filter( 'wpcf7_special_mail_tags', 'your_special_mail_tag', 10, 3 );
    
    function your_special_mail_tag( $output, $name, $html ) {
        if ( 'buf_reg' == $name )
            $output = do_shortcode( '[buf_reg]' );
    
        return $output;
    }
    

    来源:https://wordpress.org/support/topic/custom-shortcode-in-emails/#post-3931725

    【讨论】:

    • 我可以在表单中显示短代码,这就是这个插件所做的,但是我需要在发送的电子邮件中显示。谢谢
    猜你喜欢
    • 2016-08-06
    • 2016-08-16
    • 2020-10-15
    • 1970-01-01
    • 1970-01-01
    • 2012-10-22
    • 2021-01-08
    • 1970-01-01
    • 2017-06-24
    相关资源
    最近更新 更多