transmitstudio
10/16/2015 - 10:27 PM

Custom page template for Partners

Custom page template for Partners

<?php get_header(); ?>

<?php

// display user's selected header image; if not chosen, display generic header image
// header image is 2000px x 900px minimum
$header_image = get_field('post_header_image');
if( !empty($header_image) ): ?>
	<div class="xmit-page-header" style="background-image: url(<?php echo $header_image['url']; ?>);">
<?php elseif (empty($header_image)): ?>
	<div class="xmit-page-header" style="background-image:url(<?php bloginfo('stylesheet_directory');?>/images/generic-header.jpg);">
<?php endif;

	/*
	NEED TO FIX HOW THIS WORKS:
	IF we have an intro and IF it's a parent page, then: page title, page intro, page content
	IF we have an intro and IF it's a child page, then: parent title, page intro, page title, page content
	IF no intro and IF it's a parent page, then: page title, page content
	IF no intro and IF it's a child page, then: parent title, page title, page content		
			use if_child and if_ancestor (see functions.php)
	*/

// grab title background color, page intro copy, and parent page title
$title_background = get_field('title_background_color'); //this is set via a dropdown on page edit screen
$page_intro = get_field('page_intro_copy');  //this is optional and is displayed over bkgd image
$parent_title = get_the_title( $post->post_parent ); //this finds parent page title, if this is a child

//echo empty( $post->post_parent ) ? get_the_title( $post->ID ) : get_the_title( $post->post_parent );

// if there's a page intro, apply this section
if (!empty($page_intro)): ?>	
	<div id="header-holder">
		<header class="fl-post-header <?php echo $title_background ?>">
			<h1 class="fl-post-title" itemprop="headline"><?php the_title(); ?></h1>
			<!--<h1 class="fl-post-title" itemprop="headline"><?php echo $parent_title ?></h1>-->
		</header><!-- .fl-post-header -->
		<div class="page-intro">
			<div class="page-intro-content"><?php echo $page_intro ?></div>
		</div>
	</div>
</div>
<?php
// if there isn't a page intro, do this instead	
	elseif (empty($page_intro)): ?>
	<div id="header-holder">
		<header class="fl-post-header <?php echo $title_background ?>">
			<h1 class="fl-post-title" itemprop="headline"><?php the_title(); ?></h1>
			<!--<h1 class="fl-post-title" itemprop="headline"><?php echo $parent_title ?></h1>-->
		</header><!-- .fl-post-header -->
	</div>
</div>
<?php endif;
	
// now, run the loop
?>
<div class="fl-content-full container bottom-<?php echo $title_background ?>">
	<div class="row">
		<div class="fl-content col-md-12">
			<?php if(have_posts()) : while(have_posts()) : the_post(); ?>
				<?php get_template_part('content', 'page'); ?>
			<?php endwhile; endif; ?>
		</div>
	</div>
</div>

<?php
// display user's selected footer image; if not chosen, display generic footer image
// footer image is 2000px x 610px minimum
$footer_image = get_field('post_footer_image');
if( !empty($footer_image) ): ?>
	<div class="xmit-page-footer" style="background-image: url(<?php echo $footer_image['url']; ?>);"></div>
<?php elseif (empty($footer_image)): ?>
	<div class="xmit-page-footer" style="background-image:url(<?php bloginfo('stylesheet_directory');?>/images/generic-footer.jpg);"></div>
<?php endif; ?>
	
<?php get_footer(); ?>