Files
profile/entrynode-random-list.php
Andrey Kuvshinov 8fc8cbae32 add files
2025-07-09 21:21:17 +03:00

53 lines
1.9 KiB
PHP

<?php
/*
Template Name: Entry node random list new
*/
//$str = file_get_contents("https://distribution.zoid.ru/domains.json");
$domains = ["dollarcashnews.ru","dollarinform.ru","dollarnews.ru","eurocashnews.ru","euroinform.ru","gadgetinform.ru","info-health.ru","lifeautonews.ru","lifetournews.ru","moneycashnews.ru","polynews.ru","rueconews.ru","scienceinform.ru","simpleinform.ru","topeconews.ru","toptournews.ru"];
$ref = str_replace("https://", "", $_SERVER['HTTP_REFERER']);
$ref = str_replace("/", "", $ref);
$ref = str_replace("www.", "", $ref);
$isFromSF = strposa($ref, $domains);
$posts = get_posts(
array(
'post_status' => 'publish',
'post__in' => array(1014199),
'post_type' => array('profile_article'),
'posts_per_page' => 1,
'orderby' => 'date',
'order' => 'DESC'
)
);
?>
<?php get_header();?>
<div class="row clearfix d-block">
<div class="col-12 col-xl-9 float-left">
<div class="newslist">
<div class="newslist__result">
<?php foreach ($posts as $post): ?>
<?php the_post($post); ?>
<?php get_template_part( 'content', 'news' ); ?>
<?php endforeach; ?>
</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>
</div>
<?php if($isFromSF !== false): ?>
<script>
setTimeout(function(){
document.getElementsByClassName('newslist__title')[0].getElementsByTagName('a')[0].click();
}, 800);
</script>
<?php endif; ?>
<?php get_footer(); ?>