<?php
/**
 * Post list item - posts with exposed date
 *
 * @package Multi
 */

?>
<?php
$multimagazine_args         = wp_parse_args( $args );
$multimagazine_post_classes = 'post-list-item post-exposed-date';
if ( is_sticky( get_the_id() ) ) {
	$multimagazine_post_classes .= ' sticky';
}
?>
<article <?php post_class( $multimagazine_post_classes ); ?>>
	<div class="post-meta-exposed">
		<p class="post-date">
			<span class="day"><?php the_time( 'd' ); ?></span>
			<span class="month-year"><?php the_time( 'M' ); ?><br><?php the_time( 'Y' ); ?></span>
		</p>
		<?php
		if ( comments_open() ) {
			comments_popup_link( '0', '1', '%', 'comment-link' );
		}
		?>
	</div>
	<div class="the-post">
		<h2 class="post-title"><a href="<?php the_permalink(); ?>" rel="bookmark" title="<?php the_title_attribute(); ?>"><?php multimagazine_the_title(); ?></a> <?php edit_post_link( esc_html__( 'Edit this entry', 'multimagazine' ), '', '' ); ?></h2>
		<?php if ( 'off' !== $multimagazine_args['show_author'] || ( 'off' !== $multimagazine_args['show_cats'] && 0 !== count( get_the_category() ) ) || hasTag() ) : ?>
			<p class="post-meta">
				<?php if ( 'off' !== $multimagazine_args['show_author'] ) : ?>
					<span class="meta"><?php esc_html_e( 'by', 'multimagazine' ); ?> <?php the_author(); ?></span>
				<?php endif; ?>
				<?php if ( 'off' !== $multimagazine_args['show_cats'] && 0 !== count( get_the_category() ) ) : ?>
					<span class="meta"><?php the_category( ', ' ); ?></span>
				<?php endif; ?>
				<?php if ( has_tag() ) : ?>
					<span class="meta"><?php esc_html_e( 'Tags', 'multimagazine' ); ?>: <?php the_tags( '' ); ?></span>
				<?php endif; ?>
			</p>
		<?php endif; ?>
		<?php
		$multimagazine_video = get_post_meta( get_the_id(), 'multi_single_meta_video', true );
		if ( $multimagazine_video ) :
			?>
		<div class="video"><?php echo wp_oembed_get( esc_url( $multimagazine_video ) );  // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?></div>
			<?php
		elseif ( has_post_thumbnail() ) :
			?>
			<div class="img"><a href="<?php the_permalink(); ?>"><span class="img-border"><?php the_post_thumbnail( 'multimagazine-thumbnail-large' ); ?></span></a></div>
			<?php
		endif;
		?>
		<?php the_excerpt(); ?>

		<?php if ( $multimagazine_args['show_more'] ) : ?>
			<p class="more"><a href="<?php the_permalink(); ?>"><span class="screen-reader-text"><?php the_title(); ?> - </span><?php esc_html_e( 'Read more', 'multimagazine' ); ?></a></p>
		<?php endif; ?>
	</div>
</article>
