Dynamic Attachment in Mail2 Autoresponder
-
I have a custom post type. Each post has an advanced custom fields file field where we specify one free download file. I am trying to map the attachment to the autoresponder for the cf7 mail2 attachment feature and am not having much joy. I even tried doing a shortcode and using your tag for post id to get the attachment:
function coderra_resource_attach ($atts){
$atts = shortcode_atts(
array(
‘resource’ => ”,
), $atts);// Attributes
extract( shortcode_atts(array(
‘resource’ => ”
), $atts )
);ob_start();
$attachment = do_shortcode(‘[acf field=”resource_download” post_id=”‘ . $atts[‘resource’] . ‘”]’);
$new_url = str_replace(get_bloginfo(‘url’) . ‘/wp-content/’, ”, $attachment);
echo $new_url;
return ob_get_clean();
}add_shortcode(‘resource_attachment’, ‘coderra_resource_attach’);
I would then put this in the field: [resource_attachment resource=”[_post_id]”] – but this doesn’t work. I tried it by also specifying the ID instead of using your post ID tag but that didn’t work either. Any suggestions?
- The topic ‘Dynamic Attachment in Mail2 Autoresponder’ is closed to new replies.