Post Filter clearing on pagination $_post
Post Filter clearing on pagination $_post
Post Filter clearing on pagination $_post
Just released today a plugin named Cortex, freely available on GitHub. You need PHP 5.4+ and Composer to install it (docs). This plugin allows to write custom ‘routes’ to queries, it is based on Symfony routing component so mechanism of adding routes is similar to that. Here you’ll find full docs for Cortex. Using Cortex … Read more
Well, in case anyone is searching and trying to find a way to do what I did here, I figured it out myself. My task was: I have a custom post type called vehicle and there are two taxonomies, the vehicle maker and the vehicle model. I needed to show all the posts alphabetically ordered … Read more
Let’s say you have 5 instances: 200, 201, 202, 203, 204 NOT IN {200, 201, 202} is equal to IN {203, 204} (all the other instances). So you don’t need your IN operator anymore because its results are already included from using the NOT IN operator. In your case, this logic works assuming an article … Read more
Combine Tax Archive and Meta_Query in WP_Query
Multiple WordPress Sites, Same Database but Filtered Content
Here’s an example of working tax_query. The problem I’ve run into with tax_query is forgetting to nest the array (i.e. ‘tax_query’ is array(array(…)). If you don’t do that, it does not work. $args = array( ‘post_type’ => $post_type, ‘posts_per_page’ => -1, //show all posts ‘tax_query’ => array( array( ‘taxonomy’ => $taxonomy, //’field’ => ‘slug’, //’terms’ … Read more
If I understood you correctly, an array of terms either slug or term_id, for example, depending on field to be exact. $args = array( ‘post_type’ => ‘a_post_type’, ‘tax_query’ => array( ‘relation’ => ‘AND’, array( ‘taxonomy’ => ‘tax_one’, ‘field’ => ‘slug’, ‘terms’ => array( ‘action’, ‘comedy’ ), ), array( ‘taxonomy’ => ‘tax_two’, ‘field’ => ‘term_id’, ‘terms’ … Read more
1) Fixing this was surprisingly simple – I wrapped the category name request in if have_posts and that got rid of the empty values 2) I had to include a secondary loop using ‘operator’ => ‘NOT IN’ to list the treatments that were not in a taxonomy. I am sure there is a leaner and … Read more
try now this code <?php $paged = ( get_query_var( ‘paged’ ) ) ? get_query_var( ‘paged’ ) : 1; $title = get_term_by(‘slug’, get_query_var(‘term’), get_query_var(‘taxonomy’) ); $args = array( ‘post_type’ => ‘suppliers’, ‘tax_query’ => array( array( ‘taxonomy’ => ‘ad_category’, ‘field’ => ‘slug’, ‘terms’ => array(‘basic_advertiser’), ), array( ‘taxonomy’ => ‘supplier_categories’, ‘field’ => ‘slug’, ‘terms’ => $title->slug, ), … Read more