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;
}
?>