Querying Multiple Custom Taxonomy Terms

You’ll want to use the tax_query argument for query_posts/WP_Query. query_posts( array( “tax_query” => array( array( “taxonomy” => “country”, “field” => “slug”, “terms” => array( “usa”, “canada” ) ) ) ) ); The tax_query argument is an array, so you can query multiple taxonomies.

Taxonomy Relationships

Taxonomies are not child of each other unlike terms, which can be. Take a look at this flowchart: Model is a child of Make, and should not be registered as a new taxonomy. What you are trying to do, is something like setting Ford as a child of Honda, which is not right. Instead, register … Read more

have_posts() return false but count says “3”

I had same problem. According to documentation: The hierarchy for a custom taxonomy is listed below: taxonomy-{taxonomy}-{term}.php taxonomy-{taxonomy}.php taxonomy.php archive.php index.php So, it doesn’t matter witch template file you are using, all of them will generate same issue. When I put in the beginning of template file code var_dump($wp_query);, i found this: public ‘request’ => … Read more

Display certain amount of posts on taxonomy archive page

Maybe a very quick and (simplified)dirty way I show here, but would this function not solve it without the need to make changes for/in the templates? (Yes I know I also make queries in my templates but wanted to help out before leaving office) function wpse214084_max_post_queries( $query ) { if(is_tax(‘genre’)){ // change genre into your … Read more

Looping Through Custom Tax Terms and Displaying All Posts For Each

If your things are laid properly, this code will output 10 posts from film CPT, where taxonomy is category-film and it will occur each of the term of that particular taxonomy. I’m not aware about your templating, so lay your layout accordingly. <?php $_terms = get_terms( array(‘category-film’) ); foreach ($_terms as $term) : $term_slug = … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)