<?php
    $post = get_post(get_queried_object_id());
    $postcat = get_post_primary_category(get_the_ID());
    $postcat = $postcat['primary_category'];
?>
<?php $adfoxDate = date("U"); ?>
    <div class="js-ajax-data">
        <div class="row clearfix">
            <!--mamleev-template-->
            <div class="col-12 col-xl-9 float-left">
                <div class="onenews" itemscope itemtype="https://schema.org/NewsArticle">
                    <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"
                        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="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" 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;
                            echo the_content();
                            ?>
                        </div>
                        <div class="stick js-stickybit d-none d-xs-none d-lg-none">
                            <?php //echo share_block(get_the_ID()); ?>
                        </div>
                    </div>
                </div>
            </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="row clearfix d-block">
                <?php
                $mob = wp_is_mobile() ? "01" : "00";
                $pt = get_post_type(get_queried_object_id()) == "profile_article" ? "111" : "100";
                $cache_id = "01";
                //cache_id="' . wp_is_mobile() . crc32('content-page-article') . get_queried_object_id() . '"
                ?>
                <?php $shortcode = '[ajax_load_more repeater="template_20" cache="true" cache_id="'.$mob.$pt.$cache_id.get_queried_object_id().'" id="after_post_request" post_type="profile_article" post_format="standard" category__and="' . $postcat->term_id . '" button_label="Загрузить еще" posts_per_page="16" scroll_distance="50" container_type="div" post__not_in="' . get_queried_object_id() . '"]'; ?>
                <?php echo do_shortcode($shortcode); ?>
            </div>
        </div>
    </div>
