<?php
$cat = get_post_primary_category(get_the_ID());
$cat = $cat['primary_category'];
$promote_post_id = (int)get_option('_promote_post_id');
?>
<?php if (is_single()): ?>
    <?php if (get_post_format()): ?>
        <?php get_template_part( 'content', get_post_format() ); ?>
    <?php else: ?>
        <?php if(wp_is_mobile()): ?>
            <?php get_template_part( 'content-page' ); ?>
        <?php else: ?>
            <?php get_template_part( 'content-page' ); ?>
        <?php endif; ?>
    <?php endif; ?>
<?php else: ?>
    <div class="col-12 col-md-4 col-xl-3 float-left">
        <div class="article cell">
            <a class="article__frame" href="<?php echo esc_url( get_permalink() ); ?>">
                <?php if (has_post_thumbnail()): ?>
                    <!--img class="d-block lazyload" src="<?= get_template_directory_uri() ?>/assets/img/placeholder-264-264.png" data-src="<?php echo get_the_post_thumbnail_url(); ?>" alt="<?php the_title(); ?>" /-->
                    <img loading="lazy" class="d-block" src="<?php echo get_the_post_thumbnail_url(); ?>" alt="<?php the_title(); ?>" />
                <?php endif; ?>
            </a>
            <?php if ($cat->category_parent != 1): ?>
                <span class="sticker-group">
                                <?php if(get_post_type(get_the_ID()) == 'anew'): ?><a class="sticker sticker--white" href="/news">НОВОСТИ</a><?php endif; ?><a class="sticker sticker--<?php echo get_term_meta($cat->term_id,'color',1); ?>" href="<?php echo get_category_link($cat->term_id); ?>"><?php echo $cat->name; ?></a>
                            </span>
            <?php endif; ?>
            <div class="article__body">
                <time datetime="<?php echo get_the_date("Y-m-d H:s"); ?>" class="article__data">
                    <?php echo get_the_date("d.m.Y") ?>
                </time>
                <a class="article__title" href="<?php echo esc_url( get_permalink() ); ?>">
                    <?php the_title(); ?>
                </a>
                <div class="article__detail">
                    <?php if (get_post_type() !== 'anew' && $cat->term_id !== 3401): ?>
                        <?php get_template_part( 'author', 'article' ); ?>
                    <?php endif; ?>
                </div>
            </div>
        </div>
    </div>
<?php endif; ?>


