How do I display a tag cloud with both post tags AND a custom taxonomy?

The following is a slightly modified version of the wp_tag_cloud() function: function custom_wp_tag_cloud( $args=”” ) { $defaults = array( ‘smallest’ => 8, ‘largest’ => 22, ‘unit’ => ‘pt’, ‘number’ => 45, ‘format’ => ‘flat’, ‘separator’ => “\n”, ‘orderby’ => ‘name’, ‘order’ => ‘ASC’, ‘exclude’ => ”, ‘include’ => ”, ‘link’ => ‘view’, ‘taxonomy’ => ‘post_tag’, … Read more

Listing child terms of parent term

When you are on a taxonomy page, you can get the parent from the term being displayed by using the following code with get_queried_object. See get_terms for the objects that are returned $queried_object = get_queried_object(‘term’); $term = $queried_object->parent; To get the taxonomy, you can simply just add $tax = $queried_object->taxonomy; below the code above. This … Read more

Hierarchical display of custom taxonomy

The wpse244577_list_terms() function below uses wp_list_categories() to do the heavy lifting, then modifies the results so that the terms are in reverse order of the hierarchy. Place this code in a plugin or your theme’s functions.php file: /** * Lists term links for a taxonomy in reverse order of hierarchy * * Based on https://developer.wordpress.org/reference/functions/wp_list_categories/#comment-1169 … Read more

get_the_term_list without specific category

I believe that what you want is to exclude a term. It is odd that such is not an option with that function but you can use a filter on get_the_terms: function exclude_my_term($terms, $post, $taxonomy) { remove_filter(‘get_the_terms’,’exclude_my_term’,10,3); unset($terms[123]); // where 123 is the ID of the term to exclude return $terms; } add_filter(‘get_the_terms’,’exclude_my_term’,10,3); You probably … Read more

Filtering more than one term in a taxonomy in WP

You can use tax_query and use the AND condition: Reference: WP_Query under Taxonomy Parameters $args = array( ‘post_type’ => ‘post’, ‘tax_query’ => array( ‘relation’ => ‘AND’, array( ‘taxonomy’ => ‘hotels’, ‘field’ => ‘slug’, ‘terms’ => array( ‘1 Star’ ) ), array( ‘taxonomy’ => ‘location’, ‘field’ => ‘slug’, ‘terms’ => array( ‘loc1’ ) ) ) ); … Read more

Help with a query not working with custom taxonomy

Try something like this: $sotmArticle_query = new WP_Query( array( ‘post_type’ => ‘news’, ‘tax_query’ => array( array( ‘taxonomy’ => ‘postCat’, ‘field’ => ‘slug’, ‘terms’ => ‘sotm’ ) ), ‘orderby’ => ‘date’, ‘order’ => ‘DESC’, ‘posts_per_page’ => 1 ) ); if($sotmArticle_query->have_posts()){ while($sotmArticle_query->have_posts()){ $sotmArticle_query->the_post(); ?>