get_results("select id from wp_posts where 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 15", OBJECT); }else{ $ppc = (int) get_post_primary_category_id(get_queried_object_id()); if($ppc == 8529){ $ppc = 103464; } $featured = $wpdb->get_results("select id from wp_posts where 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 = " . $ppc . ") order by post_date desc limit 15", OBJECT); } $posts = array(); foreach ($featured as $item){ $post = new stdClass(); $post->id = $item->id; $post->title = htmlspecialchars(get_the_title($item->id)); $post->link = get_permalink($item->id); array_push($posts, $post); } ?>