
Hi
I have created a Custom Post Type called ‘Downloads’ and within this I have created categories.
Within ACF I have created a field called Download and within this I have a field called downloads where you can upload a file for example a zip file.
I have set up a page where all the downloads I created are called in, but I am having trouble creating the download links for each download. The links come from a mixture of categories I created when I setup the Custom Post Type.
<section class="download-section inner-page-download" id="download-section">
<div class="text-top-border"><?php echo $obj->name; ?>
</div>
<div class="padding-70">
<div class="row">
<div class="col-md-12">
<div class="download-box-row">
<?php
$i =1;
$args = array(
'post_type' => 'downloads',
'post_status' => 'publish',
'posts_per_page' => -1,
'tax_query' => array(
array(
'taxonomy' => 'category',
'field' => 'slug',
'terms' => $obj->slug,
)
)
);
$leaguedata = new WP_Query( $args );
if( $leaguedata->have_posts() ) :
while( $leaguedata->have_posts() ) :
$leaguedata->the_post();
?>
<div class="download-box" style="background-image: url('<?php echo get_field( 'background_image' ); ?>');">
<div class="download-box-img">
<img class="responsive" src="<?php echo get_field( 'image' ); ?>">
</div>
<span>
<a href="<?php the_field('downloads'); ?>" target="_blank" name="Spec Sheet"><img src="<?php echo get_field('arrow');?>"><?php the_title(); ?></a>
</span>
</div>
<?php
$i++;
endwhile;
wp_reset_postdata();
?>
<?php
else :
esc_html_e( 'No testimonials in the diving taxonomy!', 'text-domain' );
endif;
?>
</div>
</div>
</div>
<!-- Back to Download Button -->
<div class="btn-read-more" id="extra_nav">
<a href="/downloads/">Back to Downloads</a>
</div>
<!-- <a class="backToDownloads" href="/cfc/downloads/"></a> -->
</div>
</section>
I hope that makes sense!
Many Thanks