<?php
/**
 * Template Name: Resources
 *
 * This is the template that displays all pages by default.
 * Please note that this is the WordPress construct of pages and that
 * other "pages" on your WordPress site will use a different template.
 *
 * @package WordPress
 * @subpackage Twenty_Fifteen
 * @since Twenty Fifteen 1.0
 */

get_header(); ?>
<?php
// Start the loop.
while ( have_posts() ) : the_post();

  // Include the page content template.
?>





	<h1 class="title"><?php echo h1_title(); ?></h1>
	

	<div class="entry-content">

		<?php

				the_content();

				 if( have_rows('public_files') ): ?>
				 	<div class="user-download-files">
					<table class="">
						<thead>
							<tr>
								<th width="30%">Title</th>
								<th width="50%">Description</th>
								<th width="20%">&nbsp;</th>
							</tr>
						</thead>

					<?php while( have_rows('public_files') ): the_row(); 

							// vars
							$file_name = get_sub_field('public_file_file_name');
							$file_description = get_sub_field('public_file_file_description');
							$upload = get_sub_field('public_file_upload');

							
						?>

						<tr>
							<td><?php  echo $file_name; ?></td>
							<td><?php  echo $file_description; ?></td>
							<td>
								<button data-file="<?php echo $upload['url'] ?>"  type="button" class="btn btn-xoxo btn-sm btn-modal" data-toggle="modal" data-target="#myModal">
								  Download
								</button>
							</td>
						</tr>

					<?php endwhile; ?>

					</table>
					</div>
					<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
					  <div class="modal-dialog" role="document">
					    <div class="modal-content">
					      <div class="modal-header">
					        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
					        <h4 class="modal-title" id="myModalLabel">Get a Free Copy!</h4>
					      </div>
					      <div class="modal-body">
					        <?php echo do_shortcode('[contact-form-7 id="83" title="Lead Form"]'); ?>
					      </div>
					    </div>
					  </div>
					</div>

				<?php endif; ?>


				


		
	</div><!-- .entry-content -->




<?php

// End the loop.
endwhile;
?>
<?php get_footer(); ?>
