我已经在我的联系人表单7消息正文中添加了短代码,但它不起作用。
function.php
function wpb_demo_shortcode() {
$output = \'<p style="font-size:11pt;font-family:Calibri,sans-serif;margin:0;">Lets stay connected!</p>\';
return $output;
}
// register shortcode
add_shortcode(\'greeting\', \'wpb_demo_shortcode\');
/**
* A tag to be used in "Mail" section so the user receives the special tag
* [greeting]
*/
add_filter(\'wpcf7_special_mail_tags\', \'wpcf7_tag_tournament\', 10, 3);
function wpcf7_tag_tournament($output, $name, $html)
{
$name = preg_replace(\'/^wpcf7\\./\', \'_\', $name); // for back-compat
$submission = WPCF7_Submission::get_instance();
if (! $submission) {
return $output;
}
if (\'greeting\' == $name) {
return $submission->get_posted_data("greeting");
}
return $output;
}
// Other Code
add_filter( \'wpcf7_form_elements\', \'mycustom_wpcf7_form_elements\' );
function mycustom_wpcf7_form_elements( $form ) {
$form = do_shortcode( $form );
return $form;
}
我已将此代码添加到
functions.php
但是我的短代码没有在电子邮件中显示html。
Added this in the Message Body: [greeting]
非常感谢您的帮助。