Home Forums ACF PRO CPT and ACF Download Links


CPT and ACF Download Links

  • 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 class="padding-70">
    			<div class="row">
    				<div class="col-md-12">  
                    	<div class="download-box-row">
    						$i =1;
    						$args = array(
    							'post_type'   => 'downloads',
    							'post_status' => 'publish',
    							'posts_per_page' => -1,
    							'tax_query' => array(
    									'taxonomy' => 'category',
    									'field' => 'slug',
    									'terms' => $obj->slug,
    						$leaguedata = new WP_Query( $args );
    						if( $leaguedata->have_posts() ) :
    						while( $leaguedata->have_posts() ) :
    						<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' ); ?>">
    								<a href="<?php the_field('downloads'); ?>" target="_blank" name="Spec Sheet"><img src="<?php echo get_field('arrow');?>"><?php the_title(); ?></a>
    						else :
    							esc_html_e( 'No testimonials in the diving taxonomy!', 'text-domain' );
    			<!-- Back to Download Button -->
    			<div class="btn-read-more" id="extra_nav">
    				<a href="/downloads/">Back to Downloads</a>
    <!-- 			<a class="backToDownloads" href="/cfc/downloads/"></a> -->

    I hope that makes sense!

    Many Thanks

Viewing 1 post (of 1 total)

The topic ‘CPT and ACF Download Links’ is closed to new replies.