<?php
/**
 * Displays the featured image.
 */

/**
 * Check whether the 'basho_display_post_featured_image' option is activated in the Customizer.
 */
$display_post_featured_image = get_theme_mod( 'basho_display_post_featured_image', true );

if ( $display_post_featured_image && has_post_thumbnail() && ! post_password_required() ) {
	?>

	<figure class="featured-media">
		<div class="featured-media-inner">

			<?php
			if ( ! is_singular() ) {
				echo sprintf( '<a class="uk-link-reset" href="%s" rel="bookmark">%s</a>', esc_url( get_permalink() ), get_the_post_thumbnail( get_the_id(), 'large' ) );
			} else {
				the_post_thumbnail();
			}

			$caption = get_the_post_thumbnail_caption();

			if ( $caption ) {
				?>

				<figcaption class="wp-caption-text"><?php echo esc_html( $caption ); ?></figcaption>

				<?php
			}
			?>

		</div> <!-- .featured-media-inner -->
	</figure> <!-- .featured-media -->

	<?php
}
