<?php
/**
 * Template part for displaying posts
 *
 * @link https://developer.wordpress.org/themes/basics/template-hierarchy/
 *
 * @package PureNote
 */

$custom_post_class = '';
if ( ! has_post_thumbnail()){
	$custom_post_class = 'no-thumbnail';
}

$purenote_archive_page_style = purenote_get_customizer_option_value('purenote_archive_page_style');

if ( 'archive-style--classic' === $purenote_archive_page_style ) {
	$thumb_size = 'full';
} else {
	$thumb_size = 'purenote-block-medium';
}

?>
<article id="post-<?php the_ID(); ?>" <?php post_class( $custom_post_class ); ?>>
    <div class="single-post-wrap">
        <div class="post-thumbnail-wrap">
            <?php purenote_post_thumbnail($thumb_size); ?>
            <div class="post-cats-wrap">
                <span class="meta-cats">
                    <?php purenote_the_post_categories_list(get_the_ID(), 1); ?>
                </span>
            </div><!-- .post-cats-wrap -->

        </div><!-- .post-thumbnail-wrap -->

        <div class="purenote-post-content-wrap">

            <header class="entry-header">
                <?php
                if ( is_singular() ) :
                    the_title( '<h1 class="entry-title">', '</h1>' );
                else :
                    the_title( '<h2 class="entry-title"><a href="' . esc_url( get_permalink() ) . '" rel="bookmark">', '</a></h2>' );
                endif;
                ?>

                <?php if ( 'post' === get_post_type() ) : ?>
                    <div class="entry-meta purenote-flex  post-meta-wrap">
                        <span class="meta-author">
                            <?php purenote_posted_by(); ?>
                        </span>
                        <span class="meta-reading-time">
                            <?php purenote_the_estimated_reading_time(); ?>
                        </span>
                        <span class="meta-footer purenote-flex post-meta-wrap">
                            <?php purenote_entry_footer(); ?>
                        </span>
                    </div><!-- .entry-meta  post-meta-wrap -->
                <?php endif; ?>
            </header><!-- .entry-header -->

            <?php get_template_part('template-parts/partials/post/content'); ?>

            <div class="button-wrapper">
                <?php 
                    get_template_part( 'template-parts/partials/post/read', 'more' ); 
                ?>
                <span class="meta-posted-on">
                    <?php purenote_posted_on(); ?>
                </span>
            </div><!-- .button-wrapper -->

        </div><!-- .purenote-post-content-wrap -->

    </div><!-- .single-post-wrap -->
</article><!-- #post-<?php the_ID(); ?> -->
