front-page.php 2.35 KB
<?php
/**
 *
 * @package Understrap
 */

// Exit if accessed directly.

defined( 'ABSPATH' ) || exit;

$post_thumbnail_id = get_post_thumbnail_id($post->ID);
$thumbnail_image = get_posts(array('p' => $post_thumbnail_id, 'post_type' => 'attachment'));
$url = wp_get_attachment_url( get_post_thumbnail_id($post->ID), 'full' ); 
$subhead = get_field('subhead');

if ($thumbnail_image && isset($thumbnail_image[0])) {
    $img_description = $thumbnail_image[0]->post_content;
	$photo_caption = $thumbnail_image[0]->post_excerpt;
    $img_alt = get_post_meta($post_thumbnail_id , '_wp_attachment_image_alt', true);
    $img_title = $thumbnail_image[0]->post_title;
	$copy = get_field('copy', $post_thumbnail_id  );
}


get_header();
$container = get_theme_mod( 'understrap_container_type' );

if ( is_front_page() ) {
	get_template_part( 'global-templates/hero' );
}

?>

<article <?php post_class(); ?> id="post-<?php the_ID(); ?>">

<?php if ( has_post_thumbnail() ) { ?>
<div class='cap-wrap header' style=" background-image: url('<?php echo $url;?> ')">

	<div class="content-container">
		<div class="container" style="height: 100%;">
			<div class="col-md-12 fx-style">
			<div class="search-box"><div id="search-box-content"><?php the_field('page_search_block', 'option'); ?></div> <div class="search-button">Search</div></div>
			<div class="header_text">	<?php the_field('header_text'); ?>	</div>	
			</div>	
		</div>	
	</div>
	<div class='side-caption header-caption <?= (empty($copy) && empty($copy)) ? "hide" : "" ?>'>
		<a class='copy-link' aria-label="Header Slide Caption" href='#' ></a>
		<span class='image-side-caption'>
			<span class='cap'><?= $photo_caption ?></span>
			<span class='copyright'><?= ($copy) ? "&copy; ".$copy : "" ?></span>
		</span>
	</div>

</div>
</article>
<?php } ?>




<div class="wrapper" id="full-width-page-wrapper">

	<div class="<?php echo esc_attr( $container ); ?>" id="content">

		<div class="col-md-12 content-area" id="primary">

			<main class="site-main" id="main" role="main">
			<div class="header_text mobile">	<?php the_field('header_text'); ?>	</div>	
				<?php
				while ( have_posts() ) {
					the_post();
					get_template_part( 'loop-templates/content', 'front' );

				}
				?>

			</main><!-- #main -->

		</div><!-- #primary -->

	</div><!-- #content -->

</div><!-- #full-width-page-wrapper -->
<div class="overlay"></div>
<?php
get_footer();