Don’t display taxonomy if empty

What you need is set the show_option_none to a string easily recognizable and then add the result of wp_list_categories to the content only if it it does not contain that string.. So your foreach loop shoul look somethinlg like foreach( $taxonomies as $taxonomy ) { $args = array( ‘orderby’ => ‘name’, ‘echo’ => false, ‘taxonomy’ … Read more

Custom Taxonomy List with Children

Your code works perfectly in a custom taxonomy template file. CASE 1 You’re trying to use this code in a single page or something else and it doesn’t work because the object returned from get_queried_object() isn’t a taxonomy. The function get_queried_object() return the currently-queried object. So, if you need a Taxonomy Object you have to … Read more

WP_Query tax_query – Show results if child has parent X

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.

Permalinks with custom taxonomies and regular categories

Assuming 2 posts: “News about Stephen King” | Category: “News” | “Author”: “Stephen King” “Review for Under the Dome” | Category: “Reviews” | “Book”: “Under the Dome” where “Book” and “Author” are custom taxonomy. If I understand well you want that the link for first will be: /author/stephen-king/news/news-about-stephen-king and the url for the second: /book/under-the-dome/reviews/review-for-under-the-dome … Read more