outputting taxonomy hierarchy

OK, so if the empty terms shouldn’t be displayed in there, then it’ll be pretty easy 😉 All you have to do is to use wp_list_categories function: <ul> <?php wp_list_categories( array( ‘taxonomy’ => ‘sfcategory’, ‘title_li’ => false, ‘hide_empty’ => true // or false, as you wish ) ); ?> </ul>

Attempting to get number of grandchildren of page in WP_Query loop

Found a solution! $inner_query = new WP_Query(array( ‘post_parent’ => $parentid, ‘post_type’ => ‘location’, ‘posts_per_page’ => -1 ) ); $countchildren = $inner_query->post_count; $counterz = 0; if ( $inner_query->have_posts() ) { while ( $inner_query->have_posts() ) { $inner_query->the_post(); $posterid = get_the_ID(); $inner_inner_query = new WP_Query(array( ‘post_parent’ => $posterid, ‘post_type’ => ‘location’, ‘posts_per_page’ => -1 ) ); $counterz = … Read more

Custom Taxonomy – Modify Function to Get Child Category

if it is for product categories, this function only needs the category id to know the childrens: function cat_childs( $term_id = 0) { $children = get_terms( array( ‘child_of’ => $term_id, ‘taxonomy’ => ‘product_cat’, ‘hide_empty’ => true, ‘fields’ => ‘ids’, )); return ( $children ); } can be called like this: cat_childs(1234); because it can return … Read more