140 lines
4.3 KiB
PHP
140 lines
4.3 KiB
PHP
|
|
<?php
|
||
|
|
$post = get_post(get_queried_object_id());
|
||
|
|
$adfoxDate = date("U");
|
||
|
|
//$promote_post_id = (int)get_option('_promote_post_id');
|
||
|
|
$promote_post_id = 1014199;
|
||
|
|
//$promote_counter_id = (int)get_option('_promote_counter_id');
|
||
|
|
//$promote_counter_id = $promote_counter_id ? $promote_counter_id : 24504371;
|
||
|
|
$promote_counter_id = 87422562;
|
||
|
|
$mob = wp_is_mobile() ? "01" : "00";
|
||
|
|
$pt = get_post_type(get_queried_object_id()) == "profile_article" ? "01" : "00";
|
||
|
|
$cache_id = "20";
|
||
|
|
$postcat = get_post_primary_category((get_queried_object()->ID));
|
||
|
|
$postcat = $postcat['primary_category'];
|
||
|
|
?>
|
||
|
|
<?php $post = get_post(get_queried_object_id()); ?>
|
||
|
|
<?php $adfoxDate = date("U"); ?>
|
||
|
|
|
||
|
|
<script>
|
||
|
|
function isInViewport(element) {
|
||
|
|
const rect = element.getBoundingClientRect();
|
||
|
|
return (
|
||
|
|
rect.top >= 0 &&
|
||
|
|
rect.left >= 0 &&
|
||
|
|
rect.bottom <= (window.innerHeight || document.documentElement.clientHeight) &&
|
||
|
|
rect.right <= (window.innerWidth || document.documentElement.clientWidth)
|
||
|
|
);
|
||
|
|
}
|
||
|
|
document.addEventListener('scroll', function () {
|
||
|
|
const h1 = document.querySelectorAll('h1.onenews__title');
|
||
|
|
[].forEach.call(h1, function(el) {
|
||
|
|
if(isInViewport(el) && el.getAttribute('data-url') != window.location.href){
|
||
|
|
let permalink = el.getAttribute('data-url');
|
||
|
|
let title = el.innerText;
|
||
|
|
|
||
|
|
history.pushState(null, title, permalink);
|
||
|
|
|
||
|
|
if(permalink.indexOf('<?=$promote_post_id?>') !== -1 && <?=(int)$promote_post_id?> > 0) {
|
||
|
|
ym(<?=$promote_counter_id?>, "init", {
|
||
|
|
clickmap: true,
|
||
|
|
trackLinks: true,
|
||
|
|
accurateTrackBounce: true,
|
||
|
|
webvisor: true
|
||
|
|
});
|
||
|
|
let options = {
|
||
|
|
"title": title
|
||
|
|
}
|
||
|
|
ym(<?=$promote_counter_id?>, 'hit', permalink, options);
|
||
|
|
//console.log("ym <?=$promote_counter_id?> updated with " + permalink + " " + title);
|
||
|
|
//console.log('promotion counters updated');
|
||
|
|
}
|
||
|
|
document.title = title;
|
||
|
|
}
|
||
|
|
});
|
||
|
|
});
|
||
|
|
</script>
|
||
|
|
<div class="js-ajax-data">
|
||
|
|
<div class="row clearfix">
|
||
|
|
<!------------------->
|
||
|
|
|
||
|
|
<!------------------->
|
||
|
|
<?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";
|
||
|
|
$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"
|
||
|
|
scroll_distance="500"
|
||
|
|
container_type="div"
|
||
|
|
post__not_in="' . get_queried_object_id() . '"]'; ?>
|
||
|
|
<?php endif; ?>
|
||
|
|
|
||
|
|
|
||
|
|
<div class="<?php if(wp_is_mobile()): ?>col-12 <?php else: ?>row <?php endif; ?> clearfix d-block">
|
||
|
|
<?php
|
||
|
|
echo do_shortcode('
|
||
|
|
[ajax_load_more
|
||
|
|
single_post="true"
|
||
|
|
single_post_id="' .get_queried_object_id() . '"
|
||
|
|
single_post_order="1014199"
|
||
|
|
cache="true"
|
||
|
|
cache_id="0001'.get_queried_object_id().$mob.$promote_post_id.'"
|
||
|
|
|
||
|
|
repeater="template_1"
|
||
|
|
post_type="profile_article"
|
||
|
|
cta="true"
|
||
|
|
cta_position="after:1"
|
||
|
|
cta_repeater="template_19"
|
||
|
|
|
||
|
|
destroy_after="1"
|
||
|
|
]
|
||
|
|
');
|
||
|
|
//echo do_shortcode($shortcode); ?>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|