content-page.php 2.15 KB
<?php
/**
 * Partial template for content in page.php
 *
 * @package Understrap
 */

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

$slides = [];
$featured_image = null;

if(function_exists( 'get_field')) {

	$slides = get_field('header_slides', get_the_ID()); 
	$featured_image = get_the_post_thumbnail_url( get_the_ID(), 'large' );
	if(!$featured_image) {
		$featured_image = get_field('photo_from_source', get_the_ID());
	}

}
?>

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

<?php
	if (empty($slides) && (!$featured_image || is_page_template("page-templates/h1belowphoto.php") || has_term('job-profile','page_type') || has_term('job-profile-fr','page_type') || is_page_template("page-templates/campaign-landing.php") )  ) {?>
	<header class="entry-header home <?= (!has_term('job-profile','page_type'))?'no-photo':'' ?>">
<?php } else { ?>
	<header class="entry-header home">
<?php } ?>
		<?php 
			get_template_part("template-parts/header");
		?>

	</header><!-- .entry-header -->

	<?php if(is_front_page()) { ?>
		<div class='content-header-seperater'></div>
	<?php } ?>

	<div class="entry-content <?= (has_term('job-profile','page_type'))?'job-profile':'' ?>">

	<?php  
	

		if (empty($slides) && (!$featured_image || is_page_template("page-templates/h1belowphoto.php") || has_term('job-profile','page_type') || has_term('job-profile-fr','page_type') || is_page_template("page-templates/campaign-landing.php") )  ) { ?>
			<div class='no-header-photo'>
				<div class="breadcrumb"><?php get_breadcrumb(); ?></div>
				<?php the_title( '<h1 class="entry-title">', '</h1>' ); 
					$h2 = get_post_meta($post->ID, 'subhead', true);
					if(!empty($h2)) { 
				?>
				<h2 class="subhead"><?= $h2 ?></h2>
				<?php } ?>
			</div>
	<?php	}
	?>

	<?php if(has_term('urgent-job','page_type',get_the_ID()) || has_term('urgent-job-fr','page_type',get_the_ID()) ) { ?>
		<span class='urgent-header'><?= __('URGENT', 'msf') ?></span>
	<?php } ?>

		<?php
			the_content();
			understrap_link_pages();
		?>

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

	<footer class="entry-footer">

		<?php understrap_edit_post_link(); ?>

	</footer><!-- .entry-footer -->

</article><!-- #post-## -->