Custom Query: Multiple CPTs and a taxonomy filter
Custom Query: Multiple CPTs and a taxonomy filter
Custom Query: Multiple CPTs and a taxonomy filter
“Menu order” being ignored when querying posts from a parent taxonomy with “include_children” set to true
You haven’t specified the ‘field’ value e.g. ‘field’ => ‘slug’, http://codex.wordpress.org/Class_Reference/WP_Query#Taxonomy_Parameters
Answering myself, the problem was the ‘AND’, must be ‘OR’, thank you anyway.
You aren’t looping through the results. Here is your code: $m = new WP_Query( $myquery ); if ( $m->have_posts() ) : $m->the_post();?> <ul><li <?php post_class();?>><a href=”https://wordpress.stackexchange.com/questions/83409/<?php the_permalink(); ?>”><?php the_title(); ?></a></li></ul> <?php endif; wp_reset_postdata(); ?> There is no Loop. You just check for the existence of posts, echo some information about the first one and quit. … Read more
I found a solution to this myself. It returns the default post type posts instead of excluding the custom post type which is fine for my needs. function my_breakfast_query ( $query ) { // not an admin page and is the main query if (!is_admin() && $query->is_main_query()){ if (is_tax( ‘food’, ‘breakfast’ )){ $tax_query = array( … Read more
Change your code with the following: $args = array( ‘post_type’ => ‘property’, ‘posts_per_page’ => 5000, ); $statuses = explode( ‘,’, $st_term_final_string); $terms = explode( ‘,’, $il_term_final_string ); if ( $statuses || $terms ) { $args[‘tax_query’] = array(); if ( $statuses ) { $args[‘tax_query’][] = array( ‘taxonomy’ => ‘Status’, ‘field’ => ‘slug’, ‘terms’ => $statuses ); … Read more
Is the my_pagination() call within the same file as your $query declaration? If not, you need to put global $query; at the top of your template file where my_pagination() is being called. If this doesn’t solve it, please give some more information/code examples.
If I’m understanding you correctly get_term_children does what you want. $term_id = 2; $tax_name=”locations”; $term_child = get_term_children( $term_id, $tax_name ); Another possibility would be using get_categories, it has an child_of, taxonomy and depth parameter – the documentation on wp_list_categories, which offers pretty much the same functionality, is better.
I think that you are using the custom taxonomy with a incorrect concept. You should use a custom field if you want sort by its value. Thinking in numbers can be dificult to understand what a taxonomy is. But think in a way to group things where a group is not higher or lower than … Read more