50 lines
3.1 KiB
PHP
50 lines
3.1 KiB
PHP
<div class="partners">
|
|
<div class="partners__header">
|
|
Самое читаемое
|
|
</div>
|
|
<div class="row">
|
|
<?php
|
|
global $wpdb;
|
|
$i = 0;
|
|
$current = get_the_ID();
|
|
$top = array_slice((array)json_decode(get_option('ppp_options')), 0, 4);
|
|
$notin = implode(",", array_map(function($item){return (int)$item->id;},$top));
|
|
|
|
if(has_tag(103565, get_queried_object_id())){
|
|
$featured = $wpdb->get_results("select id from wp_posts where id not in (".$notin.") and 2=2 and post_type in ('anew', 'yellow') and id != ".get_queried_object_id()." and post_status = 'publish' and id not in (SELECT post_id FROM wp_postmeta WHERE meta_key = '_hide_on_website' AND meta_value = '1' ) and id not in (SELECT post_id FROM wp_postmeta WHERE meta_key = '_only_link_access' AND meta_value = '1' ) and id in (SELECT object_id FROM wp_term_relationships WHERE term_taxonomy_id = 103565 ) order by post_date desc limit 11", OBJECT);
|
|
}else{
|
|
$featured = $wpdb->get_results("select id from wp_posts where id not in (".$notin.") and 3=3 and post_type in ('anew', 'yellow') and id != ".get_queried_object_id()." and post_status = 'publish' and id not in (SELECT post_id FROM wp_postmeta WHERE meta_key = '_hide_on_website' AND meta_value = '1' ) and id not in (SELECT post_id FROM wp_postmeta WHERE meta_key = '_only_link_access' AND meta_value = '1' ) and id not in (SELECT object_id FROM wp_term_relationships WHERE term_taxonomy_id = 103565 ) and id in (SELECT object_id FROM wp_term_relationships WHERE term_taxonomy_id = ".get_post_primary_category_id(get_queried_object_id()).") order by post_date desc limit 11", OBJECT);
|
|
}
|
|
|
|
$items = array_merge($top, $featured);
|
|
$has_with_tag = false;
|
|
foreach ($items as $item):
|
|
if(has_tag(7840, $item->id)){
|
|
if($has_with_tag === true){
|
|
continue;
|
|
}
|
|
$has_with_tag = true;
|
|
}
|
|
$post = get_post($item->id);
|
|
if ($item->id == $current){ continue; }
|
|
|
|
?>
|
|
<div class="col-12 col-md-4" data-id="<?php echo $id; ?>">
|
|
<a class="partners__item d-flex d-lg-block" href="<?php echo get_permalink($post); ?>?utm_from=must-amp">
|
|
<span class="partners__frame">
|
|
<amp-img width="142px" height="80px" src="<?php echo wp_get_attachment_image_src( get_post_thumbnail_id($post), 'thumbnail' )[0]; ?>" alt="<?php echo htmlspecialchars($post->post_title); ?>">
|
|
<noscript>
|
|
<img width="142px" height="80px" src="<?php echo wp_get_attachment_image_src( get_post_thumbnail_id($post), 'thumbnail' )[0]; ?>" alt="<?php echo htmlspecialchars($post->post_title); ?>" />
|
|
</noscript>
|
|
</amp-img>
|
|
</span>
|
|
<strong class="partners__item__title">
|
|
<?php echo $post->post_title; ?>
|
|
</strong>
|
|
</a>
|
|
</div>
|
|
<?php endforeach; ?>
|
|
|
|
|
|
</div>
|
|
</div>
|