Displaying terms based on loop posts?

I think you can try the following options. wp_list_categories with the ‘show_count’ parameter http://codex.wordpress.org/Template_Tags/wp_list_categories get category and use $count = $category->category_count; http://codex.wordpress.org/Function_Reference/get_category You can traverse up the functions to get_term if those don’t work and see what is in there, even though you probably can use get the terms you will have to parse the … Read more

Get posts inside Get terms problem

When you do the following in your code $posttags = get_the_tags($item->term_id);, $item is referring to a post object, not a term object. Therefore, term_id is an invalid property. This should be throwing a PHP notice. While not certain, I think what you are intending to do is: $posttags = get_the_tags($item->ID); since get_the_tags takes a post … Read more

Show only the grandchildren (using get_terms)

I think for each term you should check that it has a parent but not have any childern So you code may look like $taxonomy = ‘world’; $tax_terms = get_terms( $taxonomy ); foreach ($tax_terms as $value){ $args=array( ‘child_of’=> $value->term_id, ); //get all child of current term $child = get_terms( $taxonomy, $args ); if( $value->parent != … Read more

Allow user to set custom order to a list of custom taxonomies?

For those interested I figured it out. I added this to my functions.php: function set_the_terms_in_order ( $terms, $id, $taxonomy ) { $terms = wp_cache_get( $id, “{$taxonomy}_relationships_sorted” ); if ( false === $terms ) { $terms = wp_get_object_terms( $id, $taxonomy, array( ‘orderby’ => ‘term_order’ ) ); wp_cache_add($id, $terms, $taxonomy . ‘_relationships_sorted’); } return $terms; } add_filter( … Read more

Getting Term ID from Term Name for WordPress Query

Check for variables names: $excludes=””; if($filtering_excludes) { $exclude_terms = explode(“, “, $filtering_excludes); foreach ($exclude_terms as $exclude_term) { $term = get_term_by( ‘name’, $exclude_term, $filtering_tax ); $exclude_term_array[] = $term->term_id; } $excludes= implode(“, “, $exclude_term_array); }

Show posts from two or more custom taxonomy terms

You need to combine two tax queries with and AND relation: $args = array( ‘posts_per_page’ => 10, // Number of posts per page ‘post_type’ => ‘classifieds’, // Custom Post Type like Movies ‘tax_query’ => array( ‘relation’ => ‘AND’ array( ‘taxonomy’ => ‘classifieds_tags’, //Custom Taxonomy Name like Genre ‘field’ => ‘slug’, ‘terms’ => array( ‘books’ //Tags … Read more