<?php
/**
 * Template part for displaying the header section on the single post template
 *
 * @package giornalismo
 */

namespace JM_Web_Development\Giornalismo;

?>

<header class="post-header">
	<?php echo wp_kses_post( giornalismo()->display_breadcrumbs() ); ?>

	<?php
	if ( get_post_meta( $post->ID, 'giornalismo_featured_video', true ) ) {
		?>
		<div class="featured-video">
			<?php echo wp_oembed_get( get_post_meta( $post->ID, 'giornalismo_featured_video', true ) ); ?>
		</div>
		<?php
	} elseif ( has_post_thumbnail() ) {
		?>
		<div class="featured-photo">
			<?php the_post_thumbnail( 'single' ); ?>
		</div>
		<?php
	}
	?>

	<?php
	if ( get_post_meta( $post->ID, 'giornalismo_photo_caption', true ) ) {
		?>
		<p class="caption"><?php echo get_post_meta( $post->ID, 'giornalismo_photo_caption', true ); ?></p>
		<?php
	}
	if ( get_post_meta( $post->ID, 'giornalismo_photo_credit', true ) ) {
		?>
		<p class="photo-credit"><?php echo get_post_meta( $post->ID, 'giornalismo_photo_credit', true ); ?></p>
		<?php
	}
	?>
	<h1 class="headline"><?php the_title(); ?></h1>
	<p class="byline">
		<?php
		if ( '1' === esc_attr( get_theme_mod( 'giornalismo-author-byline' ) ) ) {
			echo giornalismo()->display_author_byline();
		}
		?>
		<?php the_date( get_option( 'date_format' ) );?>
		<?php
		if ( '1' === esc_attr( get_theme_mod( 'giornalismo-post-comments' ) ) ) {
			echo ', ';
			comments_popup_link( esc_html__( '0 Comments', 'giornalismo' ), esc_html__( '1 Comment', 'giornalismo' ), esc_html__( '% Comments', 'giornalismo' ), '', esc_html__( 'Comments Off', 'giornalismo' ) );
		}
		?>
		</p>
	<hr />
</header>
