Using wp_list_categories to show more than one custom taxonomy
If you turn $taxonomy into an array: $taxonomy = array(‘colors’,’additional-taxonomy’, ‘another-taxonomy’, ‘etc’); You should be set
If you turn $taxonomy into an array: $taxonomy = array(‘colors’,’additional-taxonomy’, ‘another-taxonomy’, ‘etc’); You should be set
get_term_by() just returns the first matching term, ‘first’ meaning some internal order in MySQL. If having multiple terms with the same name matters in your case, don’t rely on get_term_by() alone.
(Probably better to use get_the_terms). $terms = wp_get_object_terms( $pid, ‘custom_category’, array(‘fields’=>’ids’)); Get an array of term ids (will always been array, even if it is an array of one): $ids = wp_list_pluck( $terms, ‘term_id’ ); If you just want one id… then ‘pop’ out the last id: $id = array_pop($ids); See also PHP docs on … Read more
At first, try passing the Taxonomy as a string: $children = get_term_children($term->term_id, ‘locations’); The function get_category_children produces a string as return, so you can just echo it. the function get_term_children, however, returns an array. To see the contents of the array, try print_r( $children ); instead of echo. The last thing to keep in mind … Read more
Sometimes a plugin changes WordPress’ internal rewrite rules during an update, an installation or deactivation. If the plugin’s update happens to run after your taxonomy registration it may just wipe out the custom rules for the taxonomy. To inspect the currently active rewrite rules use the plugin Monkeyman Rewrite Analyzer. See this answer for details. … Read more
Oops… just found how, by reading the source: get_term_feed_link( $my_custom_taxonomy_term->term_id, ‘my_custom_taxonomy_name’ );` It’s just not documented in the Codex.
You have a typo in orderby, and meta_value_num is only used as an orderby value, try this: $args = array( ‘post_type’ => ‘event’, ‘tax_query’ => array( array( ‘taxonomy’ => ‘locations’, ‘field’ => ‘id’, ‘terms’ => $location // location term id ) ), ‘meta_key’ => ‘event_date’, // this meta field stores event date in yymmdd format … Read more
Create a hierarchical custom taxonomy via register_taxonomy, which will function the same as the built-in Category taxonomy.
I think the best way to do this is using the loop, in the loop you need to get the terms for all associated posts. <?php if (have_posts()) : <while (have_posts()) : the_post(); //thecode endwhile; endif; ?>
As Toscho mentionned above, you didn’t close your if and while. When in doubt, indent your codes to avoid confusion. $my_query = new WP_Query( $args ); if ($my_query->have_posts()) : while($my_query->have_posts()) : $my_query->the_post(); endwhile; endif; wp_reset_postdata(); /* The 2nd Query (without global var) */ $query2 = new WP_Query( $args2 ); // The 2nd Loop if ($query2->have_posts()) … Read more