transmitstudio
10/17/2015 - 4:34 AM

Grab title background, intro block, and page title

Grab title background, intro block, and page title

<?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;