page.php 2.09 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();
$url = wp_get_attachment_url( get_post_thumbnail_id($post->ID), 'full' ); 
$container = get_theme_mod( 'understrap_container_type' );

$subhead = get_field('subhead');
$thumb_id = get_post_thumbnail_id();
$first_cap = get_field('caption');
$first_copy = get_field('copyright');

?>
<?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($first_copy) && empty($first_cap)) ? "hide" : "" ?>'>
		<a class='copy-link' aria-label="Header Slide Caption" href='#' ></a>
		<span class='image-side-caption'>
			<span class='cap'><?= $first_cap ?></span>
			<span class='copyright'><?= ($first_copy) ? "&copy; ".$first_copy : "" ?></span>
		</span>
	</div>
	</header><!-- .entry-header -->
<?php } ?>
<div class="wrapper" 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
			$parents_ids   = get_post_ancestors($post->ID);
			$top_parent_id = (count($parents_ids) > 0) ? $parents_ids[count($parents_ids)-1] : $post->ID;
		    show_all_children($top_parent_id, $post->ID, 1);
			?>
	   </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();