<?php $post = get_post(get_queried_object_id()); ?>
<!--- ajax: <?=date('Y-m-d h:i:s')?> --->
<?php $adfoxDate = date("U"); ?>
<?php if (in_array(get_post_type(), array('anew', 'yellow'))): ?>
    <!--this is anew or y !!!!! -->
    <div class="js-ajax-data">
        <div class="row clearfix">
            <!------------------->
            <div class="col-12 col-xl-9 float-left">
                <div class="onenews clearfix" itemscope itemtype="https://schema.org/NewsArticle">
                    <link itemprop="mainEntityOfPage" href="<?php echo get_permalink(); ?>"/>



                    <?php if(is_in_dk()): ?>
                        <div class="dk-banner">
                            <img class="w-100 mb-4" src="<?= get_template_directory_uri() ?>/assets/img/Delovoy_club_852x80_2.jpg" />
                        </div>
                    <?php endif; ?>
                    <h1 itemprop="name headline" class="onenews__title template-1" data-url="<?php echo esc_url(get_permalink()); ?>">
                        <?php the_title(); ?>
                    </h1>
                    <?php if (has_secondary_title()): ?>
                        <h4 class="onenews__subtitle d-lg-flex">
                            <?php echo get_secondary_title(); ?>
                        </h4>
                    <?php endif; ?>
                    <div class="publication__data">
                                <span class="publication__number" itemprop="datePublished"
                                      content="<?php echo get_the_date("Y-m-d"); ?>">
                                    <?php if (is_array(get_post_custom_values('num'))): ?>
                                        <?php $num = get_post_custom_values('num'); ?>
                                        <?php echo array_shift($num); ?>
                                    <?php else: ?>
                                        <?php echo get_the_date("d.m.Y") ?>
                                        <?php if (get_post_type() == 'anew'): ?>
                                            <?php echo get_the_time("H:i") ?>
                                        <?php endif; ?>
                                    <?php endif; ?>
                                </span>
                        <?php if(get_post_type() === 'archive'): ?>
                            <?php get_template_part('author', 'archive'); ?>
                        <?php elseif (in_array(get_post_type(), array('anew', 'yellow'))): ?>
                            <?php get_template_part('author', 'news'); ?>
                        <?php else: ?>
                            <?php get_template_part('author', 'single'); ?>
                        <?php endif; ?>
                    </div>

                    <div class="onenews__body">
                        <div class="stick js-stickybit d-none d-lg-block">
                            <?php //echo share_block(get_the_ID()); ?>
                        </div>

                        <?php if (has_post_thumbnail() && show_thumbnail()): ?>
                            <figure itemprop="image" itemscope itemtype="https://schema.org/ImageObject">
                                <link itemprop="url" href="<?php echo get_the_post_thumbnail_url(get_queried_object_id(), 'large'); ?>" />
                                <link itemprop="contentUrl" href="<?php echo get_the_post_thumbnail_url(get_queried_object_id(), 'large'); ?>" />
                                <?php echo get_the_post_thumbnail($post, 'large'); ?>
                                <?php $thumb = get_post(get_post_thumbnail_id()); ?>
                                <figcaption itemprop="description">
                                    <?php if (strlen($thumb->post_content) !== 0): ?>
                                        <p><?php echo $thumb->post_content; ?></p>
                                    <?php endif; ?>
                                    <?php if (strlen($thumb->post_excerpt) !== 0 && !strposa($thumb->post_excerpt, ['instag', 'faceb', 'инстаг'])): ?>
                                        <span>©<?php echo str_replace(array("Фото: ", "Фото:"), "", main_photo_caption($thumb->post_excerpt)); ?></span>
                                    <?php endif; ?>
                                </figcaption>
                            </figure>
                        <?php endif; ?>
                        <div class="micromarking" itemprop="articleBody" data-post-type="<?php echo get_post_type(); ?>">
                            <?php
                            global $more;
                            $more = 1;








                            echo the_content();

                            ?>
                        </div>
                        <div class="stick js-stickybit d-xs-none d-lg-none">
                            <?php echo share_block(get_the_ID()); ?>
                        </div>
                    </div>
                </div>
                <!-- [Panda] -->
                <?php //get_template_part('partner', 'panda'); ?>
                <!-- [/Panda] -->
                <?php /*
                        <div class="read-yzd">
                            <?php if (get_post_type(get_queried_object_id()) == 'profile_article'): ?>
                                Избранные статьи в  <a href="tg://resolve?domain=profilejournal" target="_blank" rel="noopener">telegram-канале <span class="read-yzd__red">ProfileJournal</span></a>
                            <?php else: ?>
                                Оперативные и важные новости в нашем <a href="tg://resolve?domain=profile_newzzz" target="_blank" rel="noopener">telegram-канале <span class="read-yzd__red">Профиль-News</span></a>
                            <?php endif; ?>
                            <br/>
                            Больше интересного на канале <a rel="noopener" href="https://zen.yandex.ru/profile.ru?clid=300" target="_blank"><span class="read-yzd__red">Дзен</span>-Профиль</a>
                        </div>
                        */ ?>
                <?php get_template_part('content', 'subscribe_disclaimer'); ?>
                <?php get_template_part('content', 'post_tags'); ?>
                <?php /*
                        <div class="read-yzd mobile-only">
                            <div>Скачайте мобильное приложение и читайте журнал "Профиль" бесплатно:</div>
                            <a class="float-xs-none float-md-left mobile-button mr-2" href="https://apps.apple.com/ru/app/id6476872853" target="_blank">
                                <img loading="lazy" src="<?= get_template_directory_uri() ?>/assets/img/px.gif" data-src="<?= get_template_directory_uri() ?>/assets/img/appstore.png" width="103" height="32" alt="" />
                            </a>
                            <a class="float-xs-none float-md-left mobile-button" href="https://play.google.com/store/apps/details?id=com.quazarteam.Profile" target="_blank">
                                <img loading="lazy" src="<?= get_template_directory_uri() ?>/assets/img/px.gif" data-src="<?= get_template_directory_uri() ?>/assets/img/googleplay.png" width="115" height="32" alt="" />
                            </a>
                        </div>
                        */ ?>






                <?php if(get_queried_object_id() == 892805): ?>

                    <!-- [Popular-] -->
                    <div class="partners" data-id="<?php echo $post->ID ?>" data-type="in_use">
                        <div class="partners__header">
                            Самое читаемое<!--!!!-->
                        </div>
                        <div class="row">
                            <?php
                            global $wpdb;
                            $i = 0;
                            $current = $post->ID;

                            $news = get_posts(
                                array(
                                    'post_type' => array('anew'),
                                    'posts_per_page' => 10
                                )
                            );

                            $newsToPrint = array();

                            $l = 0;

                            foreach ($news as $new):
                                if(!has_tag(103565, $new->ID)):
                                    $l++;
                                    array_push($newsToPrint, $new->ID);
                                    ?>
                                    <?php if (wp_is_mobile()): ?>
                                    <div class="col-12 col-md-4 d-none notagregator" data-id="<?php echo $new->ID; ?>">
                                        <a class="partners__item d-flex d-lg-block" href="<?php echo get_permalink($post); ?>?utm_from=must-main">
                                                <span class="partners__frame">
                                                    <?php if (has_post_thumbnail($post)): ?>
                                                        <?php if (wp_is_mobile()): ?>
                                                            <img loading="lazy" width="80px" height="80px" class="lazyload" src="<?= get_template_directory_uri() ?>/assets/img/Profile_lazyload_264x264.webp" data-src="<?php echo wp_get_attachment_image_src(get_post_thumbnail_id($post), 'thumbnail')[0]; ?>" alt="<?php echo $post->post_title; ?>">
                                                        <?php else: ?>
                                                            <img loading="lazy" width="265px" height="149px" class="lazyload" src="<?= get_template_directory_uri() ?>/assets/img/Profile_lazyload_m.webp" data-src="<?php echo wp_get_attachment_image_src(get_post_thumbnail_id($post), 'medium')[0]; ?>" alt="<?php echo $post->post_title; ?>">
                                                        <?php endif; ?>
                                                    <?php else: ?>
                                                        <img loading="lazy" src="<?= get_template_directory_uri() ?>/assets/img/Profile_lazyload_m.webp" alt="<?php echo $post->post_title; ?>">
                                                    <?php endif; ?>
                                                </span>
                                            <strong class="partners__item__title">
                                                <?php echo $post->post_title; ?>
                                            </strong>
                                        </a>
                                    </div>
                                <?php else: ?>
                                    <div class="col-12 col-md-4 d-none notagregator" data-id="<?php echo $new->ID; ?>" data-date="<?php echo get_the_date('d.m.Y', $new->ID); ?>">
                                        <a class="partners__item d-flex d-lg-block" href="<?php echo get_permalink($post); ?>?utm_from=must-main">
                                                <span class="partners__frame">
                                                    <?php if (has_post_thumbnail($post)): ?>
                                                        <?php if (wp_is_mobile()): ?>
                                                            <img loading="lazy" width="80px" height="80px" class="lazyload" src="<?= get_template_directory_uri() ?>/assets/img/Profile_lazyload_264x264.webp" data-src="<?php echo wp_get_attachment_image_src(get_post_thumbnail_id($post), 'thumbnail')[0]; ?>" alt="<?php echo $post->post_title; ?>">
                                                        <?php else: ?>
                                                            <img loading="lazy" class="lazyload" src="<?= get_template_directory_uri() ?>/assets/img/Profile_lazyload.jpg" data-src="<?php echo wp_get_attachment_image_src(get_post_thumbnail_id($post), 'medium')[0]; ?>" alt="<?php echo $post->post_title; ?>">
                                                        <?php endif; ?>
                                                    <?php else: ?>
                                                        <img loading="lazy" src="<?= get_template_directory_uri() ?>/assets/img/Profile_lazyload.jpg" alt="<?php echo $post->post_title; ?>">
                                                    <?php endif; ?>
                                                </span>
                                            <strong class="partners__item__title">
                                                <?php echo $post->post_title; ?>
                                            </strong>
                                        </a>
                                    </div>
                                <?php endif; ?>
                                <?php
                                endif;
                            endforeach;

                            ?>



                            <?php

                            $current_category = $post->post_category[0];
                            $top = (array)json_decode(get_option('ppp_options'));

                            usort($top, function($a, $b) {return get_the_date("Ymd", $a->id) < get_the_date("Ymd", $b->id);});

                            $has_with_tag = false;
                            /*$featured = $wpdb->get_results("select post_id as `id`, 0 as `count` from $wpdb->postmeta where meta_value != '0' and meta_key = 'featured_post_promotion' order by meta_value DESC ", OBJECT);
                            if (count($featured) != 0) {
                                array_unshift($top, $featured[0]);
                            }*/
                            $move = $wpdb->get_results("select post_id as id, 9999 as `count` from wp_postmeta where `meta_key` = 'featured_post_promotion' and `meta_value` = 1 order by meta_id desc limit 1", OBJECT);
                            if(count($move) != 0){
                                array_unshift($top, $move[0]);
                            }



                            foreach ($top as $item):
                                $i++;
                                $hide = get_post_meta($item->id, 'popular_hide', true);
                                if($hide !== "" || in_array($item->id, $newsToPrint)){
                                    continue;
                                }
                                if(has_tag(7840, $item->id)){
                                    if($has_with_tag === true){
                                        continue;
                                    }
                                    $has_with_tag = true;
                                }

                                $post = get_post($item->id);
                                ?>
                                <?php if (wp_is_mobile()): ?>
                                <div class="col-12 col-md-4 d-none agregator" data-id="<?php echo $item->id; ?>">
                                    <a class="partners__item d-flex d-lg-block" href="<?php echo get_permalink($post); ?>?utm_from=must-main">
                                                <span class="partners__frame">
                                                    <?php if (has_post_thumbnail($post)): ?>
                                                        <?php if (wp_is_mobile()): ?>
                                                            <img loading="lazy" width="80px" height="80px" class="lazyload" src="<?= get_template_directory_uri() ?>/assets/img/Profile_lazyload_264x264.webp" data-src="<?php echo wp_get_attachment_image_src(get_post_thumbnail_id($post), 'thumbnail')[0]; ?>" alt="<?php echo $post->post_title; ?>">
                                                        <?php else: ?>
                                                            <img loading="lazy" class="lazyload" src="<?= get_template_directory_uri() ?>/assets/img/Profile_lazyload_m.webp" data-src="<?php echo wp_get_attachment_image_src(get_post_thumbnail_id($post), 'medium')[0]; ?>" alt="<?php echo $post->post_title; ?>">
                                                        <?php endif; ?>
                                                    <?php else: ?>
                                                        <img loading="lazy" src="<?= get_template_directory_uri() ?>/assets/img/Profile_lazyload_m.webp" alt="<?php echo $post->post_title; ?>">
                                                    <?php endif; ?>
                                                </span>
                                        <strong class="partners__item__title">
                                            <?php echo $post->post_title; ?>
                                        </strong>
                                    </a>
                                </div>
                            <?php else: ?>
                                <div class="col-12 col-md-4 d-none agregator" data-id="<?php echo $item->id; ?>" data-date="<?php echo get_the_date('d.m.Y', $item->id); ?>">
                                    <a class="partners__item d-flex d-lg-block" href="<?php echo get_permalink($post); ?>?utm_from=must-main">
                                                <span class="partners__frame">
                                                    <?php if (has_post_thumbnail($post)): ?>
                                                        <?php if (wp_is_mobile()): ?>
                                                            <img loading="lazy" width="80px" height="80px" class="lazyload" src="<?= get_template_directory_uri() ?>/assets/img/Profile_lazyload_264x264.webp" data-src="<?php echo wp_get_attachment_image_src(get_post_thumbnail_id($post), 'thumbnail')[0]; ?>" alt="<?php echo $post->post_title; ?>">
                                                        <?php else: ?>
                                                            <img loading="lazy" class="lazyload" src="<?= get_template_directory_uri() ?>/assets/img/Profile_lazyload.jpg" data-src="<?php echo wp_get_attachment_image_src(get_post_thumbnail_id($post), 'medium')[0]; ?>" alt="<?php echo $post->post_title; ?>">
                                                        <?php endif; ?>
                                                    <?php else: ?>
                                                        <img loading="lazy" src="<?= get_template_directory_uri() ?>/assets/img/Profile_lazyload.jpg" alt="<?php echo $post->post_title; ?>">
                                                    <?php endif; ?>
                                                </span>
                                        <strong class="partners__item__title">
                                            <?php echo $post->post_title; ?>
                                        </strong>
                                    </a>
                                </div>
                            <?php endif; ?>
                            <?php endforeach; ?>
                        </div>
                    </div>
                    <script>
                        (function () {
                            let visited = (getCookie('visited') + ',<?php echo $current; ?>').split(',').filter(onlyUnique).join(',');
                            //console.log(visited);
                            setCookie('visited', visited, {secure: true, 'max-age': 3600});
                            let list = document.querySelectorAll('.partners[data-id="<?php echo get_queried_object_id(); ?>"] .row > div.agregator');
                            let list2 = document.querySelectorAll('.partners[data-id="<?php echo get_queried_object_id(); ?>"] .row > div.notagregator');
                            let i = 0, j = 0, k = 0, l = 0, m = 0, n = 0;
                            while (i < <?php echo $i; ?>) {
                                if (typeof (list[i]) != "object") {
                                    return;
                                }
                                let id = list[i].getAttribute('data-id');
                                if (visited.split(',').indexOf(id) == -1 && j < 2) {
                                    list[i].classList.remove("d-none");
                                    j++;
                                }
                                i++;
                            }


                            while (l < <?php echo $l; ?>) {
                                if (typeof (list[l]) != "object") {
                                    return;
                                }
                                let id = list[i].getAttribute('data-id');
                                if (visited.split(',').indexOf(id) == -1 && j < 2) {
                                    list[i].classList.remove("d-none");
                                    j++;
                                }
                                i++;
                            }



                            while (j < 3) {

                                list[k].classList.remove("d-none");
                                j++;
                                k++;
                            }
                        })();

                        function getCookie(name) {
                            let matches = document.cookie.match(new RegExp(
                                "(?:^|; )" + name.replace(/([\.$?*|{}\(\)\[\]\\\/\+^])/g, '\\$1') + "=([^;]*)"
                            ));
                            return matches ? decodeURIComponent(matches[1]) : undefined;
                        }

                        function onlyUnique(value, index, self) {
                            return (self.indexOf(value) === index && value == parseInt(value, 10));
                        }

                        function setCookie(name, value, options = {}) {
                            options = {
                                path: '/',
                                expires: 0
                            };
                            if (options.expires.toUTCString) {
                                options.expires = options.expires.toUTCString();
                            }
                            let updatedCookie = encodeURIComponent(name) + "=" + encodeURIComponent(value);
                            for (let optionKey in options) {
                                updatedCookie += "; " + optionKey;
                                let optionValue = options[optionKey];
                                if (optionValue !== true) {
                                    updatedCookie += "=" + optionValue;
                                }
                            }
                            document.cookie = updatedCookie;
                        }
                    </script>
                    <!-- [/Popular] -->






































                <?php else: ?>
                    <?php if(get_post_type(get_queried_object_id()) != 'profile_article'): ?>
                    <?php if(get_queried_object_id() !== 865671): ?>
                    <!-- [Popular+] -->
                    <div class="partners" data-id="<?php echo $post->ID ?>" data-type="in_use">
                        <div class="partners__header">
                            Самое читаемое<!--@@@-->
                        </div>
                        <div class="row">
                            <?php
                            global $wpdb;
                            $i = 0;
                            $current = $post->ID;
                            $current_category = $post->post_category[0];
                            $top = (array)json_decode(get_option('ppp_options'));

                            usort($top, function($a, $b) {return property_exists($a, 'id') && property_exists($b, 'id') ? get_the_date("Ymd", $a->id) < get_the_date("Ymd", $b->id) : false;});

                            $has_with_tag = false;
                            /*$featured = $wpdb->get_results("select post_id as `id`, 0 as `count` from $wpdb->postmeta where meta_value != '0' and meta_key = 'featured_post_promotion' order by meta_value DESC ", OBJECT);
                            if (count($featured) != 0) {
                                array_unshift($top, $featured[0]);
                            }*/
                            $move = $wpdb->get_results("select post_id as id, 9999 as `count` from wp_postmeta where `meta_key` = 'featured_post_promotion' and `meta_value` = 1 order by meta_id desc limit 1", OBJECT);
                            if(get_current_user_id() === 1) {
                                if (count($move) != 0) {
                                    //array_unshift($top, $move[0]);
                                    array_splice($top, 1, 0, $move);
                                }
                            }

                            $zn = has_category(104807, get_queried_object_id());

                            $top = array_slice($top, 0, 6);

                            foreach ($top as $item):

                                $i++;
                                if (!property_exists($item, 'id')){
                                    continue;
                                }



                                $hide = get_post_meta($item->id, 'popular_hide', true);
                                if($hide !== ""){
                                    continue;
                                }
                                if($zn && has_tag(103565, $item->id)){
                                    continue;
                                }
                                if(has_tag(7840, $item->id)){
                                    if($has_with_tag === true){
                                        continue;
                                    }
                                    $has_with_tag = true;
                                }

                                $post = get_post($item->id);
                                if((date("U") - date("U", strtotime($post->post_date))) > 48*60*60 && !get_post_meta($item->id, 'featured_post_promotion', true)){
                                    continue;
                                }
                                ?>
                                <?php if (wp_is_mobile()): ?>
                                <div class="col-12 col-md-4 d-none" data-id="<?php echo $item->id; ?>">
                                    <a class="partners__item d-flex d-lg-block" href="<?php echo get_permalink($post); ?>?utm_from=must-main">
                                                        <span class="partners__frame">
                                                            <?php if (has_post_thumbnail($post)): ?>
                                                                <?php if (wp_is_mobile()): ?>
                                                                    <img loading="lazy" width="80px" height="80px" class="lazyload" src="<?= get_template_directory_uri() ?>/assets/img/Profile_lazyload_264x264.webp" data-src="<?php echo wp_get_attachment_image_src(get_post_thumbnail_id($post), 'thumbnail')[0]; ?>" alt="<?php echo $post->post_title; ?>">
                                                                <?php else: ?>
                                                                    <img loading="lazy" width="265px" height="149px" class="lazyload" src="<?= get_template_directory_uri() ?>/assets/img/Profile_lazyload_m.webp" data-src="<?php echo wp_get_attachment_image_src(get_post_thumbnail_id($post), 'medium')[0]; ?>" alt="<?php echo $post->post_title; ?>">
                                                                <?php endif; ?>
                                                            <?php else: ?>
                                                                <img loading="lazy" src="<?= get_template_directory_uri() ?>/assets/img/Profile_lazyload_m.webp" alt="<?php echo $post->post_title; ?>">
                                                            <?php endif; ?>
                                                        </span>
                                        <strong class="partners__item__title">
                                            <?php if($post->ID == 1014199) {echo 'В России придумали, как избежать штрафов за превышение средней скорости';}else{echo $post->post_title;} ?>
                                        </strong>
                                    </a>
                                </div>
                            <?php else: ?>
                                <div class="col-12 col-md-4 d-none" data-id="<?php echo $item->id; ?>" data-date="<?php echo get_the_date('d.m.Y', $item->id); ?>">
                                    <a class="partners__item d-flex d-lg-block" href="<?php echo get_permalink($post); ?>?utm_from=must-main">
                                                        <span class="partners__frame">
                                                            <?php if (has_post_thumbnail($post)): ?>
                                                                <?php if (wp_is_mobile()): ?>
                                                                    <img loading="lazy" width="80px" height="80px" class="lazyload" src="<?= get_template_directory_uri() ?>/assets/img/Profile_lazyload_264x264.webp" data-src="<?php echo wp_get_attachment_image_src(get_post_thumbnail_id($post), 'thumbnail')[0]; ?>" alt="<?php echo $post->post_title; ?>">
                                                                <?php else: ?>
                                                                    <img loading="lazy" width="265px" height="149px" class="lazyload" src="<?= get_template_directory_uri() ?>/assets/img/Profile_lazyload.jpg" data-src="<?php echo wp_get_attachment_image_src(get_post_thumbnail_id($post), 'medium')[0]; ?>" alt="<?php echo $post->post_title; ?>">
                                                                <?php endif; ?>
                                                            <?php else: ?>
                                                                <img loading="lazy" src="<?= get_template_directory_uri() ?>/assets/img/Profile_lazyload.jpg" alt="<?php echo $post->post_title; ?>">
                                                            <?php endif; ?>
                                                        </span>
                                        <strong class="partners__item__title">
                                            <?php if($post->ID == 1014199) {echo 'В России придумали, как избежать штрафов за превышение средней скорости';}else{echo $post->post_title;} ?>
                                        </strong>
                                    </a>
                                </div>
                            <?php endif; ?>
                            <?php endforeach; ?>
                        </div>
                    </div>
                    <script>
                        (function () {
                            let visited = (getCookie('visited') + ',<?php echo $current; ?>').split(',').filter(onlyUnique).join(',');

                            setCookie('visited', visited, {secure: true, 'max-age': 3600});
                            let list = document.querySelectorAll('.partners[data-id] .row > div');

                            let i = 0, j = 0, k = 0;
                            while (i < <?php echo $i; ?>) {
                                if (typeof (list[i]) != "object") {
                                    break;
                                }

                                let id = list[i].getAttribute('data-id');
                                if (visited.split(',').indexOf(id) == -1 && j < 3) {
                                    list[i].classList.remove("d-none");
                                    j++;
                                }
                                i++;
                            }

                            while (j < 3) {

                                list[k].classList.remove("d-none");
                                j++;
                                k++;
                            }
                        })();

                        function getCookie(name) {
                            let matches = document.cookie.match(new RegExp(
                                "(?:^|; )" + name.replace(/([\.$?*|{}\(\)\[\]\\\/\+^])/g, '\\$1') + "=([^;]*)"
                            ));
                            return matches ? decodeURIComponent(matches[1]) : undefined;
                        }

                        function onlyUnique(value, index, self) {
                            return (self.indexOf(value) === index && value == parseInt(value, 10));
                        }

                        function setCookie(name, value, options = {}) {
                            options = {
                                path: '/',
                                expires: 0
                            };
                            if (options.expires.toUTCString) {
                                options.expires = options.expires.toUTCString();
                            }
                            let updatedCookie = encodeURIComponent(name) + "=" + encodeURIComponent(value);
                            for (let optionKey in options) {
                                updatedCookie += "; " + optionKey;
                                let optionValue = options[optionKey];
                                if (optionValue !== true) {
                                    updatedCookie += "=" + optionValue;
                                }
                            }
                            document.cookie = updatedCookie;
                        }
                    </script>
                    <!-- [/Popular] -->
                <?php endif; ?>
                <?php endif; ?>

                <?php endif; ?>





                <!-- [Partners] -->
                <?php get_template_part('content', 'partners' . ((wp_is_mobile()) ? '-mobile' : '')); ?>
                <!-- [/Partners] -->
            </div>
            <!------------------->
            <?php if (wp_is_mobile()): ?>
                <?php
                //cache_id="0017' . wp_is_mobile() . crc32('content-page-article') . get_queried_object_id() . '"
                $mob = wp_is_mobile() ? "01" : "00";
                $pt = get_post_type(get_queried_object_id()) == "profile_article" ? "01" : "00";
                $cache_id = "01";
                if (has_category(104807, get_queried_object_id())){
                    $shortcode = '
                        [ajax_load_more 
                        container_type="div" 
                        css_classes="col-12"  
                        repeater="template_17" 
                        cache="true"
                        cache_id="' . $mob . $pt . $cache_id . '10480703" 
                        id="after_post_request" 
                        post_type="' . get_post_type(get_queried_object_id()) . '" 
                        post_format="standard"  
                        button_label="Загрузить больше новостей" 
                        posts_per_page="14" 
                        destroy_after="100"
                        max_pages="100"
                        scroll_distance="500" 
                        container_type="div" 
                        category="znaj-nashih"
                        post__not_in="' . get_queried_object_id() . '"]';
                } else {
                    $shortcode = '
                        [ajax_load_more 
                        container_type="div" 
                        css_classes="col-12"  
                        repeater="template_17" 
                        cache="true"
                        cache_id="' . $mob . $pt . $cache_id . '" 
                        id="after_post_request" 
                        post_type="' . get_post_type(get_queried_object_id()) . '" 
                        post_format="standard"  
                        button_label="Загрузить больше новостей" 
                        posts_per_page="14" 
                        destroy_after="100"
                        max_pages="100"
                        scroll_distance="500" 
                        container_type="div" 
                        post__not_in="' . get_queried_object_id() . '"]';
                }?>
            <?php endif; ?>
            <?php if(!wp_is_mobile() && get_queried_object_id() !== 865671): ?>
            <div class="col-12 col-xl-3 float-left d-none d-xl-block">
                <div class="right-side">
                    <?php dynamic_sidebar('right_sidebar'); ?>
                </div>
                <div class="js-stickybit">
                    <?php if (!wp_is_mobile()): ?>
                        <div class="special--main special__multi special--gray cell d-flex justify-content-center align-items-center"
                             style="width:264px;height:264px;">
                            <?php
                            if (test_ad()) {
                                echo '
                                            <div id="AdwolfBanner264x264_568990" ></div>
                                            <script type="text/javascript" >
                                                new Adwolf({
                                                    placeholderId: \'AdwolfBanner264x264_568990\',
                                                    width: 264,
                                                    height: 264,
                                                    link: \'https://a.adwolf.ru/3145/prepareCode?pp=bl&ps=cmm&p2=kn&pct=a&plp=a&pli=a&pop=a&pr=\'}, {puids:{}}, {paps:{}}, {});
                                            </script>
                                        ';
                            } else {
                                if (!defined('MAX_PATH')) {
                                    define('MAX_PATH', '/var/www/revive');
                                }

                                if (@include_once(MAX_PATH . '/www/delivery/alocal.php')) {
                                    if (!isset($phpAds_context)) {
                                        $phpAds_context = array();
                                    }
                                    $phpAds_raw = view_local('', 2, 0, 0, '', '', '0', $phpAds_context, '');
                                    echo $phpAds_raw['html'];
                                }

                            }
                            ?>
                            <?php if((int)get_option('show_ad') == 1): ?>
                                <!--montemedia-->
                                <!--Площадка: profile.ru / desktop / 264x264-1-->
                                <!--Категория: <не задана>-->
                                <!--Тип баннера: тип 1-->
                                <div id="adfox_163361830916372382_<?=$adfoxDate?>"></div>
                                <script>
                                    window.yaContextCb.push(()=>{
                                        Ya.adfoxCode.create({
                                            ownerId: 242477,
                                            containerId: 'adfox_163361830916372382_<?=$adfoxDate?>',
                                            params: {
                                                p1: 'ciwcq',
                                                p2: 'fpld'
                                            }
                                        })
                                    })
                                </script>
                            <?php endif; ?>
                        </div>

                        <?php

                        $categories = get_the_category();
                        $category_id = $categories[0]->cat_ID;

                        if (((int)get_option('show_ad') == 1) && $category_id !== 8529 && get_the_category(get_queried_object_id())[0]->term_id !== 8529): ?>
                            <div class=" special__multi special--gray cell d-flex justify-content-center align-items-center adfox-hidden" style="min-height: 26.5rem;padding: .75rem 0;">

                                <!--montemedia-->
                                <!--Площадка: profile.ru / desktop / 240х400-1-->
                                <!--Категория: <не задана>-->
                                <!--Тип баннера: 240x400--new-->
                                <div id="adfox_163361827364277543_<?=$adfoxDate?>" class="js-hide-notload"></div>
                                <script>
                                    window.yaContextCb.push(()=>{
                                        Ya.adfoxCode.create({
                                            ownerId: 242477,
                                            containerId: 'adfox_163361827364277543_<?=$adfoxDate?>',
                                            params: {
                                                p1: 'ciwck',
                                                p2: 'gkel'
                                            }
                                        })
                                    })
                                </script>
                                <script>

                                    var hideNotload = document.querySelectorAll('.js-hide-notload');

                                    for (i = 0; i < hideNotload.length; ++i) {
                                        var target = hideNotload[i];
                                        hideNotload[i].style.color = "green";
                                        const config = {
                                            attributes: false,
                                            childList: true,
                                            subtree: false
                                        };
                                        const callback = function (mutationsList, observer) {
                                            for (let mutation of mutationsList) {
                                                if (mutation.type === 'childList') {
                                                    target.parentNode.classList.remove('adfox-hidden');
                                                    //console.log('A child node has been added or removed.');
                                                } else if (mutation.type === 'attributes') {
                                                    //console.log('The ' + mutation.attributeName + ' attribute was modified.');
                                                }
                                            }
                                        };
                                        const observer = new MutationObserver(callback);
                                        observer.observe(target, config);
                                    }
                                </script>
                            </div>
                        <?php endif; ?>
                    <?php endif; ?>
                </div>
            </div>
        </div>
        <?php endif; ?>
        <div class="<?php if(wp_is_mobile()): ?>col-12 <?php else: ?>row <?php endif; ?> clearfix d-block">
            <?php if (!wp_is_mobile()): ?>
                <?php
                $mob = wp_is_mobile() ? "01" : "00";
                $pt = get_post_type(get_queried_object_id()) == "profile_article" ? "01" : "00";
                $cache_id = "01";
                $postcat = get_post_primary_category((get_queried_object()->ID));
                $postcat = $postcat['primary_category'];
                //cache_id="' . wp_is_mobile() . crc32('content-page-article') . get_queried_object_id() . '"
                ?>
                <?php
                if (has_category(104807, get_queried_object_id())){
                    $shortcode = '
                        [ajax_load_more 
                        cache_id="' . $mob . $pt . $cache_id . '10480701"
                        category="znaj-nashih"
                        cache="true" 
                        id="after_post_request" 
                        post_type="'.get_post_type(get_queried_object_id()).'" 
                        post_format="standard" 
                        button_label="Загрузить еще" 
                        posts_per_page="14" 
                        scroll_distance="50" 
                        container_type="div" 
                        post__not_in="' . get_queried_object_id() . '"
                    ]';

                } else {
                    $shortcode = '
                    [ajax_load_more 
                        cache="true" 
                        cache_id="'.$mob.$pt.$cache_id.'" 
                        id="after_post_request" 
                        post_type="'.get_post_type(get_queried_object_id()).'" 
                        post_format="standard" 
                        button_label="Загрузить еще" 
                        posts_per_page="14" 
                        scroll_distance="50" 
                        container_type="div" 
                        post__not_in="' . get_queried_object_id() . '"
                    ]';} ?>
            <?php endif; ?>
            <?php echo do_shortcode($shortcode); ?>
        </div>
    </div>
    </div>





























<?php else: ?>
    <div class="js-ajax-data">
        <div class="row clearfix">
            <!--this is pa-->
            <div class="col-12 col-xl-9 float-left">
                <div class="onenews clearfix" itemscope itemtype="https://schema.org/Article">
                    <link itemprop="mainEntityOfPage" href="<?php echo get_permalink(); ?>"/>
                    <div class="d-none" itemprop="publisher" itemscope itemtype="https://schema.org/Organization">
                        <div class="d-none" itemprop="logo" itemscope itemtype="https://schema.org/ImageObject">
                            <link itemprop="url" content="<?= get_template_directory_uri() ?>/assets/img/profil-logo.png"/>
                        </div>
                        <meta itemprop="name" content="<?php bloginfo(); ?>"/>
                        <link itemprop="url" content="<?php echo home_url(); ?>"/>
                    </div>
                    <span itemprop="articleSection" class="d-none"><?php the_category(); ?></span>
                    <meta itemprop="inLanguage" content="ru"/>
                    <meta itemprop="dateModified" content="<?php echo the_modified_date("c  "); ?>"/>
                    <h1 itemprop="name headline" class="onenews__title template-2"
                        data-url="<?php echo esc_url(get_permalink()); ?>">
                        <?php the_title(); ?>
                    </h1>
                    <div>
                        <?= first_sentence( wpautop( get_the_content() ) ) ?>
                    </div>
                    <?php if (has_secondary_title()): ?>
                        <h4 class="onenews__subtitle d-lg-flex">
                            <?php echo get_secondary_title(); ?>
                        </h4>
                    <?php endif; ?>
                    <div class="publication__data">
                        <span class="publication__number" itemprop="datePublished"
                              content="<?php echo get_the_date("Y-m-d"); ?>">
                            <?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 if (get_post_type() == 'anew'): ?>
                                    <?php echo get_the_time("H:i") ?>
                                <?php endif; ?>
                            <?php endif; ?>
                        </span>
                        <?php if(get_post_type() === 'archive'): ?>
                            <?php get_template_part('author', 'archive'); ?>
                        <?php elseif (in_array(get_post_type(), array('anew', 'yellow'))): ?>
                            <?php get_template_part('author', 'news'); ?>
                        <?php else: ?>
                            <?php get_template_part('author', 'single'); ?>
                        <?php endif; ?>
                    </div>
                    <div class="onenews__body">
                        <div class="stick js-stickybit d-none d-lg-block">
                            <!--div class="ya-share2" data-services="facebook,vkontakte,twitter,telegram,odnoklassniki"></div-->
                            <?php echo share_block(get_the_ID()); ?>
                        </div>
                        <?php if (has_post_thumbnail() && show_thumbnail()): ?>
                            <figure itemprop="image" itemscope itemtype="https://schema.org/ImageObject" id="attachment_<?php echo get_post_thumbnail_id(); ?>">
                                <link itemprop="url" href="<?php echo get_the_post_thumbnail_url(get_queried_object_id(), 'large'); ?>" />
                                <link itemprop="contentUrl" href="<?php echo get_the_post_thumbnail_url(get_queried_object_id(), 'large'); ?>" />
                                <?php echo get_the_post_thumbnail($post, array(782, 440)); ?>
                                <?php $thumb = get_post(get_post_thumbnail_id()); ?>
                                <figcaption itemprop="description">
                                    <?php if (strlen($thumb->post_content) !== 0): ?>
                                        <p><?php echo $thumb->post_content; ?></p>
                                    <?php endif; ?>
                                    <?php if (strlen($thumb->post_excerpt) !== 0 && !strposa($thumb->post_excerpt, ['instag', 'faceb', 'инстаг'])): ?>
                                        <span>©<?php echo str_replace(array("Фото: ", "Фото:"), "", main_photo_caption($thumb->post_excerpt)); ?></span>
                                    <?php endif; ?>
                                </figcaption>
                            </figure>
                        <?php endif; ?>
                        <div class="micromarking" itemprop="articleBody"
                             data-post-type="<?php echo get_post_type(); ?>">
                            <?php
                            global $more;
                            $more = 1;




                            the_content();

                            die;


                            ?>
                        </div>
                        <div class="stick js-stickybit d-xs-none d-lg-none">
                            <!--div class="ya-share2" data-services="facebook,vkontakte,twitter,telegram,odnoklassniki"></div-->
                            <?php echo share_block(get_the_ID()); ?>
                        </div>
                    </div>
                </div>
                <?php
                if (!get_post_meta(get_the_ID(), '_hide_related', true) && function_exists('yarpp_related')) {
                    yarpp_related(array("post_type" => array(get_post_type())), get_the_ID(), true);
                }
                ?>

                <div class="read-yzd">
                    <?php if (get_post_type(get_queried_object_id()) == 'profile_article'): ?>
                        Избранные статьи в  <a href="tg://resolve?domain=profilejournal" target="_blank"
                                               rel="noopener">telegram-канале <span class="read-yzd__red">ProfileJournal</span></a>
                    <?php else: ?>
                        Оперативные и важные новости в нашем <a href="tg://resolve?domain=profile_newzzz"
                                                                target="_blank" rel="noopener">telegram-канале <span
                                    class="read-yzd__red">Профиль-News</span></a>
                    <?php endif; ?>
                    <br/>
                    Больше интересного на канале <a rel="noopener" href="https://zen.yandex.ru/profile.ru?clid=300"
                                                    target="_blank"><span class="read-yzd__red">Дзен</span>-Профиль</a>
                </div>
                <?php get_template_part('content', 'post_tags'); ?>
                <?php /*
                        <div class="read-yzd mobile-only">
                            <div>Скачайте мобильное приложение и читайте журнал "Профиль" бесплатно:</div>
                            <a class="float-xs-none float-md-left mobile-button mobile-ios" href="https://apps.apple.com/ru/app/id6476872853" target="_blank">
                                <img loading="lazy" src="<?= get_template_directory_uri() ?>/assets/img/appstore.png" width="103" height="32" alt="" />
                            </a>
                            <a class="float-xs-none float-md-left mobile-button mobile-not-ios" href="https://play.google.com/store/apps/details?id=com.quazarteam.Profile" target="_blank">
                                <img loading="lazy" src="<?= get_template_directory_uri() ?>/assets/img/googleplay.png" width="115" height="32" alt="" />
                            </a>
                        </div>
                        */ ?>
                <!-- [Popular] -->
                <?php get_template_part('content', 'popular'); ?>
                <!-- [/Popular] -->
                <div class="partners pb-4">
                    <?php get_template_part("adfox_ad_block_inread_mobile-1"); ?>
                </div>
                <!-- [Partners] -->
                <?php get_template_part('content', 'partners' . ((wp_is_mobile()) ? '-mobile' : '')); ?>
                
            </div>
            <div class="col-12 col-xl-3 float-left d-none d-xl-block">
                <div class="right-side">
                    <?php dynamic_sidebar('right_sidebar'); ?></div>
                <div class="js-stickybit">
                    <?php get_template_part('content', 'ad'); ?>
                </div>
            </div>
        </div>
        <div class="<?php if(wp_is_mobile()): ?>col-12 <?php else: ?>row <?php endif; ?> clearfix d-block">
            <?php
            $mob = wp_is_mobile() ? "01" : "00";
            $pt = get_post_type(get_queried_object_id()) == "profile_article" ? "01" : "00";
            $cache_id = "01";
            //cache_id="' . wp_is_mobile() . crc32('content-page-article') . get_queried_object_id() . '"
            ?>
            <?php $shortcode = '[ajax_load_more cache="true" cache_id="'.$mob.$pt.$cache_id.'" id="after_post_request" post_type="profile_article" post_format="standard" category__and="' . $postcat->term_id . '" button_label="Загрузить еще" posts_per_page="14" scroll_distance="50" container_type="div" post__not_in="' . get_queried_object_id() . '"]'; ?>
            <?php echo do_shortcode($shortcode); ?>
        </div>
    </div>
    </div>
<?php endif; ?>
