<?php
/**
 * Post list item - post with a medium image
 *
 * @package Multi
 */

?>
<?php
$multimagazine_args         = wp_parse_args( $args );
$multimagazine_post_classes = 'post-list-item post-medium-image';
if ( is_sticky( get_the_id() ) ) {
	$multimagazine_post_classes .= ' sticky';
}
?>
<article <?php post_class( $multimagazine_post_classes ); ?>>
<?php
$multimagazine_video = get_post_meta( get_the_id(), 'multi_single_meta_video', true );
if ( $multimagazine_video ) :
	?>
	<div class="img medium"><div class="video"><?php echo wp_oembed_get( esc_url( $multimagazine_video ) );  // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?></div></div>
<?php elseif ( has_post_thumbnail() ) : ?>
	<div class="img medium"><a href="<?php the_permalink(); ?>"><span class="img-border"><?php the_post_thumbnail( 'multimagazine-thumbnail-small' ); ?></span></a></div>
	<?php
endif;
?>
	<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 ( $multimagazine_args['show_meta'] ) : ?>
			<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_date'] ) : ?>
					<span class="meta"><?php the_time( get_option( 'date_format' ) ); ?></span>
				<?php endif; ?>
				<?php if ( 'off' !== $multimagazine_args['show_cats'] && 0 !== count( get_the_category() ) ) : ?>
					<span class="meta"><?php the_category( ', ' ); ?></span>
				<?php endif; ?>
			</p>
		<?php endif; ?>
		<p class="post-excerpt"><?php echo wp_kses_post( multimagazine_custom_excerpt( 40, $post, $multimagazine_args['show_more'] ) ); ?></p>
		<?php if ( has_tag() ) : ?>
			<p class="tags"><i class="m-icon m-icon-tag"></i> <?php esc_html_e( 'Tags', 'multimagazine' ); ?>: <?php the_tags( ' ' ); ?></p>
		<?php endif; ?>
		<?php if ( comments_open() ) : ?>
			<p class="comments"><?php comments_popup_link( '0', '1', '%', 'comment-link' ); ?></p>
		<?php endif; ?>
		<?php do_action( 'multimagazine_post_links' ); ?>
	</div>
</article>
