I have a pretty simple custom post type ("weekly_mktg_report") that has two fields - date("date") and attachment("report"). I've created an archive page that uses
<a href="<?php the_field('report'); ?>" target="_blank">
This creates a link to the attachment and not the actual custom post, which is perfect for what I'm trying to accomplish.
I'm trying to do the same thing on another page that link to the attachment of the most recent of these custom post types.
This is what I tried, but isn't working
<?php
$args = array(
'numberposts' => '5',
'orderby' => 'post_date',
'order' => 'DESC',
'include' => '',
'exclude' => '',
'meta_key' => '',
'meta_value' =>'',
'post_type' => 'weekly_mktg_report',
'post_status' => 'publish'
);
$recent_posts = wp_get_recent_posts( $args );
foreach( $recent_posts as $recent ){
echo '<li><a href="' . get_permalink($recent["ID=>the_field('report') "]) . '">' . $recent["post_title"].'</a> </li> ';
}
wp_reset_query();
?>
I know there's something wrong w/ the way I'm trying to append my get.parmalink to go to the attachment ("report") instead of the actual custom post page. Any help would be greatly appreciated.