Exclude Posts in a Given Category

Check if the array contains a category not tested live but is valid PHP <?php $myquery[‘tax_query’] = array( ‘relation’ => ‘OR’, array( ‘taxonomy’ => ‘category’, ‘category__not_in’ => array(‘explore’), ‘field’ => ‘slug’, ), array( ‘taxonomy’ => ‘category’, ‘terms’ => array(‘outdoor-recreation’), ‘field’ => ‘slug’, ), array( ‘taxonomy’ => ‘take_category’, ‘terms’ => array(‘outdoor-recreation’), ‘field’ => ‘slug’, ), array( … Read more

Changing an item in drop down after 5 latest posts per taxonomy

Have a closer look to the blow code- $query_args = array( ‘posts_per_page’ => ‘5’, ‘orderby’ => ‘post_date’, ‘order’ => ‘DESC’, ); $listedPosts = new WP_Query($query_args); // the loop if ( $listedPosts->have_posts() ) { while ( $listedPosts->have_posts() ) { $listedPosts->the_post(); if ( (int) $listedPosts->current_post == 5 ) { // You need to use ‘==’ or ‘===’ … Read more