Here, i have a modal, where it holds my featured image. What i want is, how can i link my featured image to a file/pdf so that if user clicks the featured image, then there will be a pdf downloaded.
Problem: All i want is to link my featured image to a file. How can i do it? where the user uploads a file in the media and how can i link it with my featured image?
Here i set my modal to a post. Here is my code:
<!-- Modal -->
<div id="myModal38" class="modal fade" tabindex="-1">
<?php $idObj = get_category_by_slug('water-pumps-modal');
$args1 = array(
'post_type' => 'post',
/*'category_name' => 'modal',*/
'category__in' => array( $idObj->term_id ), // Take only IDs of the categories
'posts_per_page' => '1',
);
$modalPost = new WP_Query( $args1 );
if( $modalPost->have_posts() ) :
?>
<div class="modal-dialog">
<?php while ( $modalPost->have_posts() ) : $modalPost->the_post(); ?>
<div class="modal-content">
<div class="modal-header">
<button class="close" type="button" data-dismiss="modal">×</button>
<h4 class="modal-title"><?php the_title(); ?></h4>
</div>
<div class="modal-body">
<?php the_post_thumbnail(); ?>
<?php the_content(); ?>
<?php endwhile; ?>
</div>
<?php endif; ?>
<?php wp_reset_postdata(); ?>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
<!-- Modal -->