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

How to List Custom Post Type Titles Based on Theirs Taxonomy Terms Inside a Nested Loop

Retrieval of multiple posts in WordPress is almost always handled by WP_Query class (or get_posts() function that wraps it). There is quite a lot of documentation and information to it, but to narrowing it down to your specific case you will need to: set up posts loop for each term pass as arguments to each … 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

Looping through custom taxonomy and display custom post types (Custom Post Type UI)

Try this, this should retrieve all taxonomies terms including empty ones. <?php $terms = get_terms(‘price_types’, array( ‘hide_empty’ => false, ‘orderby’ => ‘name’, ‘order’ => ‘ASC’ ) ); echo print_r($terms); foreach( $terms as $term ): ?> <section class=”pricing”> <h2><?php echo $term->name; ?></h2> </section> <?php endforeach; ?>

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

Get terms for a specfic post from multiple taxonomies in custom post type

You kind of not telling what the problem is, like debug, error message you get. There is most likely something wrong with how you wrote that, I’m not willing to go trough this right now. But generally you should make this cleaner and separate parts for an better structure, regarding the taxonomy name as id … Read more