page.php 2.31 KB
<?php
/**
 * The template for displaying all pages
 *
 * 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 Understrap
 */

// Exit if accessed directly.
defined( 'ABSPATH' ) || exit;

get_header();

$container = get_theme_mod( 'understrap_container_type' );

$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  );
}





?>
<?php if ( has_post_thumbnail() ) { ?>
	<header class="entry-header page" style=" background-image: url('<?php echo $url;?> ')">
	 
		<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='side-caption header-caption <?= (empty($copy) && empty($cap)) ? "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>
	</header><!-- .entry-header -->
<?php } ?>
<div class="wrapper side-menu-page" id="page-wrapper">

	<div class="<?php echo esc_attr( $container ); ?>" id="content" tabindex="-1">
	   <div class="col-sm-12 col-md-12 col-lg-3 widget-area" id="page-sidebar">
	   <?php
			echo wpse_get_ancestor_tree();
			?>
	   </div>	
		<main class="col-sm-12 col-md-9 content-area site-main site-main" id="main">
			
		<div class="breadcrumb"><?php get_breadcrumb(); ?></div> 
	
			<?php
			while ( have_posts() ) {
				the_post();
				
				get_template_part( 'loop-templates/content', 'page' );
			}
			?>

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

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

</div><!-- #page-wrapper -->

<?php
get_footer();