<?php
/**
 * @package Bravisthemes
 */
$archive_readmore_text = breeza()->get_theme_opt('archive_readmore_text', esc_html__('Continue Reading', 'breeza'));
$archive_category = breeza()->get_theme_opt( 'archive_category', true );
$archive_author = breeza()->get_theme_opt( 'archive_author', true );
$archive_date = breeza()->get_theme_opt( 'archive_date', true );
$archive_meta = breeza()->get_theme_opt( 'archive_meta', true );
?>
<article id="post-<?php the_ID(); ?>" <?php post_class('pxl---post pxl-item--archive pxl-item--standard'); ?>>
    <?php if (has_post_thumbnail()) { 
        echo '<div class="pxl-item--image">'; ?>
        <a href="<?php echo esc_url( get_permalink()); ?>" <?php if (has_post_thumbnail($post->ID) && wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), false)) { $thumbnail_url = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'full'); ?>style="background-image: url(<?php echo esc_url($thumbnail_url[0]); ?>);"<?php } ?>><?php the_post_thumbnail('full'); ?></a>
        <?php 
        if($archive_category) : ?>            
            <span class="pxl-item--category"><?php the_terms( get_the_ID(), 'category', '', ', ', '' ); ?></span>             
        <?php endif; 
        ?>
        <?php if($archive_date) : ?>
            <span class="pxl-item--date">
                <i class="fas fa-calendar-alt"></i>
                <?php echo get_the_date(); ?></span>
            <?php endif; ?> 
            <?php echo '</div>';
        } ?>
        <div class="pxl-item--holder">
            <?php if($archive_author) : ?>                   
                <div class="pxl-item--author">
                    <?php 
                    $postID = get_the_ID();
                    $author = get_user_by('ID', get_post_field('post_author', $postID));                
                    $avatar_url = get_avatar_url($author->ID);
                    $author_name = $author->display_name; 
                    if ($author || !empty($user_position)) {                                
                        echo '<img src="' . esc_url($avatar_url) . '" alt="' . esc_attr($author_name) . '" />';                                
                    } ?> 
                    <?php echo esc_html__('By', 'breeza'); ?>&nbsp;<?php the_author_posts_link(); ?></div>
                <?php endif; ?>
                <h5 class="pxl-item--title">
                    <a href="<?php echo esc_url( get_permalink()); ?>" title="<?php the_title_attribute(); ?>">
                        <?php if(is_sticky()) { ?>
                            <i class="caseicon-check-mark pxl-mr-4"></i>
                        <?php } ?>
                        <?php the_title(); ?>
                    </a>
                </h5>                
                <div class="pxl-item--excerpt">
                    <?php
                    breeza()->blog->get_excerpt();
                    wp_link_pages( array(
                        'before'      => '<div class="page-links">',
                        'after'       => '</div>',
                        'link_before' => '<span>',
                        'link_after'  => '</span>',
                    ) );
                    ?>
                </div> 
                <div class="pxl-item--readmore">
                    <a class="btn--readmore" href="<?php echo esc_url( get_permalink()); ?>">                    
                        <span class="btn--icon pxl-mr-11 rtl-reverse">
                            <svg xmlns="http://www.w3.org/2000/svg" width="32" height="19" viewBox="0 0 32 19" fill="none">
                              <path d="M23.0107 18.0412L32 9.02058L23.0107 -3.92935e-07L21.4998 1.5162L27.9099 7.94855L1.55991e-06 7.94855L1.46618e-06 10.0927L27.9097 10.0927L21.4998 16.5249L23.0107 18.0412Z" fill="#194341"/>
                          </svg>
                      </span>                    
                      <span class="btn--text"><?php echo breeza_html($archive_readmore_text); ?></span>
                  </a>
              </div>
          </div>
      </article>