How to get post count including nested categories
How to get post count including nested categories
How to get post count including nested categories
Figured it out. The solution was to include the tax query array inside another array: // tax_query needs to be an Array of an Array ‘tax_query’ => array( array( ‘taxonomy’ => ‘vodka_type’, ‘field’ => ‘slug’, ‘terms’ => $type, ), ),
I had a answer in development then I read what you were looking for some more. I will need more info before I can help. Is a reviewer/speaker a custom post type or a user? Is this relationship only going to be displayed on the article. Or will you also be displaying it on the … Read more
I think your issue is with the rewrite portion when you registered the custom taxonomy with posts. ‘rewrite’ => array(‘slug’ => ‘some-slug’, ‘with_front’ => false) You can replace some-slug with anything you would like. It might be possible to replace it with article/event-category to get the results you want. Setting with_front to false removes blog … Read more
Yo might want to have a look at this post: Getting taxonomy terms used by custom post type You can include the empty terms by passing ‘hide_empty’ => 0,.
You need to use the methods of your query instance, rather than the global functions (which are merely wrappers for the global $wp_query): if ( $query->have_posts() ) { $term = $query->queried_object; while ( $query->have_posts() ) : $query->the_post(); //Output my posts the_title(); the_content(); endwhile; }
I can’t comment so I have to provide an answer which I don’t have a full answer. If I were you I would print_r($slug) and see what it gives you. The $slug variable is most likely not in a format that ‘terms’ can accept.
The problem is higher in your code. $cat = get_cat_ID($developer); will return false for a custom taxonomy, as it only checks the standard categories. Use get_term_by instead.
To retrieve all the terms attached to your taxonomy “brochure_categories”, you can use get_terms() function. More info here. Once you’ve got your terms, you can traverse them and query your custom posts with: $query = new WP_Query( array( ‘post_type’ => ‘brochures’, ‘brochure_categories’ => $current_category, ‘posts_per_page’ => -1, ‘order’ => ‘ASC’, ‘orderby’ => ‘title’, ) ); … Read more
‘LIKE’ isn’t supported by the current version of WP_Tax_Query, so you’ll need to write a custom query. This answer from a couple of years ago still seems to be the best approach: https://wordpress.stackexchange.com/a/133805/26317.