/ Published in: PHP
WordPress top posts: custom post type / taxonomy Ordered by comment count
Expand |
Embed | Plain Text
global $blog_id; global $post; $termies = get_the_terms( $post->id, 'TAXONOMY_NAME' ); foreach( $termies as $term ) { $terms_slugs[] = $term->slug; // save the slugs in an array } 'post_type'=> 'POST_TYPE', 'taxonomy' => 'TAXONOMY_NAME', 'term' => $term->slug, 'orderby' => 'comment_count', 'showposts' => '5' ); query_posts( $query ); if (have_posts()) : while (have_posts()) : the_post(); echo '<div class="top-posts">'; echo '<li><a href="'; echo '" title="'; echo'"><div class="comment-img">'; echo '</div></a>'; echo '<a class="title" href="'; echo '" title="'; echo '">'; echo '</a>'; echo '<div class="author">'; echo '</div>'; endwhile; endif; wp_reset_query(); echo '</ul>'; echo '</div>';
Comments
Subscribe to comments
You need to login to post a comment.

WordPress - Top Posts in Custom Post Type / Taxonomy ordered by comment count