I am slowly going mad trying to figure this out..
I want to list custom post type 'mobile_review' by custom taxonomy 'mobile_phone', as multipe custom post types share this taxonomy I need some way to segment.
So far I have this:
function get_terms_by_post_type($taxonomies,$args){
$args = array(
'post_type' => 'mobile_review'
);
// The query for posts of type 'mobile_review'
$the_query = new WP_Query( $args );
// The Loop
while ( $the_query->have_posts() ) : $the_query->the_post();
//get terms
//$mobs = wp_get_object_terms($post->ID,"mobile_phone");
$mobs = get_terms('mobile_phone');
$count = count($terms);
if ( $count > 0 ){
echo "<ul>";
foreach ( $terms as $term ) {
echo "<li>" . $term->name . "</li>";
}
echo "</ul>";
}
endwhile;
// Reset Post Data
wp_reset_postdata();
}
Am I close? I have been hacking back and forth for ages and getting nowhere.
Any help would be great! Thanks in advance.