I am using Contact Form 7 plugin with this addon "Contact Form 7 Dynamic Text Extension" which allows you to use shortcodes to add data to your emails and form elements https://wordpress.org/plugins/contact-form-7-dynamic-text-extension/
I created a shortcode that based on the current page adds a link to a PDF file in the Autoresponder email that is sent.
function get_pdf_link( $atts ) {
global $post;
switch ($post->post_title) {
case 'Agency':
return '<a rel="nofollow" target="_blank" href="http://example.com/qcmresearch/wp-content/uploads/2018/04/Agency-Evaluation-Checklist.pdf">Download the Agency Evaluation Checklist</a>';
break;
case 'Signup':
return '<a rel="nofollow" target="_blank" href="http://example.com/qcmresearch/wp-content/uploads/2018/04/signup.pdf">Download the Signup Options</a>';
break;
default:
return '<a rel="nofollow" target="_blank" href="http://example.com/qcmresearch/wp-content/uploads/2018/04/Agency-Evaluation-Checklist.pdf">Download the Agency Evaluation Checklist</a>';
break;
}
}
add_shortcode( 'CF7_EBOOK_DOWNLOADFILE', 'get_pdf_link' );
The value from the shortcode gets added to the autoresponder email correctly but the a tag is not formatted into html and displays as code:
<a rel="nofollow" target="_blank" href="http://example.com/wp-content/uploads/2018/04/Agency-Evaluation-Checklist.pdf">Download the Agency Evaluation Checklist</a>
It should be formatted like this
Download the Agency Evaluation Checklist
I manually added the same link to the message body in Wordpress and it looked fine so there is something with the shortcode or how I added my link that is breaking the formatting.
Update:
I inspected the <a>
tag in developer tools @ Yahoo mail and it is wrapped in parenthesis not sure why though "<a ...>Download the Agency Evaluation</a>"