<?php
    $cat = get_post_primary_category(get_the_ID());
    $cat = $cat['primary_category'];
?>
<div class="col-12 col-md-8 col-xl-6 float-left">
    <?php if(1 == 2): ?>
        <div class="article article--main cell cell--main">
                <a class="article__frame" href="https://profile.ru/tag/military-donbass/">
                        <img loading="lazy" class="d-block lazyload" <?php if(wp_is_mobile()): ?>src="<?= get_template_directory_uri() ?>/assets/img/Profile_lazyload_m.webp"<?php else: ?>src="<?= get_template_directory_uri() ?>/assets/img/Profile_lazyload.jpg"<?php endif; ?>
                        data-src="https://cdn.profile.ru/wp-content/uploads/2022/02/armiya-.jpg"
                        alt="Операция по демилитаризации Украины" />
                </a>
                <div class="article__body">
                        <div class="article__detail article__detail--lg">
                            <span class="article__data">
                                <?php echo date("d.m.Y") ?>
                            </span>
                        </div>
                        <a class="article__title article__title--lg" href="https://profile.ru/tag/military-donbass/">
                            Операция по демилитаризации Украины
                        </a>
                    <div class="article__detail article__detail--lg">
                        <span class="article__author">Еженедельный журнал "Профиль"</span>
                    </div>
                </div>
        </div>
    <?php else: ?>
        <div class="article article--main cell cell--main">
                <a class="article__frame" href="<?php echo esc_url( get_permalink() ); ?>">
                    <?php if (has_post_thumbnail()): ?>
                        <img loading="lazy" class="d-block lazyload" <?php if(wp_is_mobile()): ?>src="<?= get_template_directory_uri() ?>/assets/img/Profile_lazyload_m.webp"<?php else: ?>src="<?= get_template_directory_uri() ?>/assets/img/Profile_lazyload.jpg"<?php endif; ?> data-src="<?php echo get_the_post_thumbnail_url(get_the_ID(), array(782,440)); ?>" alt="<?php the_title(); ?>" />
                    <?php endif; ?>
                    <?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; ?>
                </a>
                <div class="article__body">
                        <div class="article__detail article__detail--lg">
                                    <span class="article__data">
                                                <?php if (is_array(get_post_custom_values('num'))): ?>
                                                    <?php echo array_shift((get_post_custom_values('num'))); ?>
                                                <?php else: ?>
                                                    <?php echo get_the_date("d.m.Y") ?>
                                                <?php endif; ?>
                                    </span>
                        </div>
                        <a class="article__title article__title--lg" href="<?php echo esc_url( get_permalink() ); ?>">
                                <?php the_title(); ?>
                        </a>
                    <div class="article__detail article__detail--lg">
                        <?php get_template_part( 'author', 'article' ); ?>
                    </div>
                </div>
        </div>
    <?php endif; ?>