<?php
/**
 * The default template for displaying content.
 * Used for both singular and index.
 */
?>

<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>

	<?php

	get_template_part( 'partials/entry-header' );

	if ( ! is_search() ) {
		get_template_part( 'partials/featured-image' );
	}

	?>

	<div class="entry-content-wrapper">

		<div class="entry-content">

			<?php

			if ( is_search() || ! is_singular() ) {
				the_excerpt();
			} else {
				the_content( __( 'Continue reading', 'eisai' ) );
			}

			?>

		</div> <!-- .entry-content -->

	</div> <!-- .entry-content-wrapper -->

	<div class="entry-footer">
		<?php

		wp_link_pages(
			array(
				'before'      => '<div class="uk-link-text uk-text-bold"><nav class="post-nav-links" aria-label="' . esc_attr__( 'Page', 'eisai' ) . '"><span class="label">' . __( 'Pages:', 'eisai' ) . '</span>',
				'after'       => '</nav></div>',
				'link_before' => '<span class="page-number">',
				'link_after'  => '</span>',
			)
		);

		edit_post_link( __( 'Edit', 'eisai' ), '<div class="edit-link-wrapper">', ' <span aria-hidden="true"><span data-uk-icon="icon: eisai-edit; ratio: .55"></span></span></div>', null, 'uk-link' );

		// Entry footer post meta.
		eisai_the_post_meta( get_the_ID(), 'entry-footer' );

		if ( is_single() ) {

			get_template_part( 'partials/entry-author-bio' );

			get_template_part( 'partials/navigation' );

		}

		?>
	</div> <!-- .entry-footer -->

	<?php

	/**
	 * Output comments wrapper if it's a post, or if comments are open,
	 * or if there's a comment number – and check for password.
	 * */
	if ( ( is_single() || is_page() ) && ( comments_open() || get_comments_number() ) && ! post_password_required() ) {
		?>

		<div class="comments-wrapper">

			<?php comments_template(); ?>

		</div> <!-- .comments-wrapper -->

		<?php
	}

	?>

</article> <!-- #post-<?php the_ID(); ?> -->
