<?php
/**
 * The template for displaying a full width title
 *
 * @package WordPress
 * @subpackage Edition
 * @since Edition 1.0
 */
global
$background_url,
$tw_options,
$pageID,
$fields_installed;

if ( ! $pageID  && is_a( $post, 'WP_Post' ) ) {
	$pageID = $post->ID ? $post->ID : false;
} ?>

<!-- Full Width Post Title -->
<div class="pagetitleloading">
	<div class="pagetitle item" <?php if ( $background_url ) { echo  "style='background: url($background_url);'"; } ?>>
		<div class="overlay"></div>

			<!-- Centering Title -->
			<div class="slidecaptionwrap">
				<div class="slidecaptioncenter container">
					<div class="slidecaption">
						<div class="col-md-8 posttitle">
							<h1 class="title">
								<?php
									if ( is_category() ) {
										single_cat_title("", true);
									} else if ( function_exists( 'is_woocommerce' ) && is_woocommerce() ) {
										woocommerce_page_title();
									} else if ( is_search() ) {
										_e("Search Results for:", 'themewich'); echo '&nbsp;<span class="highlight">'; the_search_query(); echo '</span>';
									} else if ( is_tag() ) {
										single_tag_title("", true);
									} else if ( is_author() ) {
										$author_id = get_the_author_meta('ID');
										$author_name = get_the_author_meta('display_name');
										$author_url = get_the_author_meta('user_url');
										if ( get_the_author_meta( 'description' ) ) {
											echo __('About', 'themewich') . ' ' . $author_name;
										} else {
											echo __('Posts By', 'themewich') . ' ' . $author_name;
										}
									} else if ( is_404() ) {
										_e("Error 404: Nothing Found", 'themewich');
									} else if ( ! is_page() ) {
										_e( 'Latest Posts', 'themewich' );
									} else {
										echo get_the_title($pageID);
									}
								?>
							</h1>
							<h2 class="subheadline">
								<?php
									if ( is_category() ) {
										echo strip_tags( category_description() );
									} else if ( is_tag() ) {
										echo strip_tags( tag_description() );
									} else if ( function_exists( 'is_woocommerce') && is_woocommerce() ) {
										echo strip_tags( term_description() );
									} else if ( is_search() || is_author() ) {
									} else {
									    if ( $fields_installed ) {
									        echo wp_kses_post( get_field('page_subtitle', $pageID) );
                                        }
									}
								?>
							</h2>
						</div>
						<div class="col-md-4 breadcrumbs">
							<?php
								if ( $fields_installed && get_field('breadcrumbs', $pageID) == 'on' ) :
									tw_breadcrumb();
								else :
                                    if ( $fields_installed ) {
                                        echo wp_kses_post( get_field('right_area_content', $pageID) );
                                    }
								endif;
							?>
						</div>
						<div class="clear"></div>
					</div>
				</div>
			</div>
			<!-- End Centering Title -->

	</div>
</div>
<!-- Full Width Post Title -->