热门帖子:按评论计数自定义帖子类型/分类法
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了热门帖子:按评论计数自定义帖子类型/分类法相关的知识,希望对你有一定的参考价值。
WordPress top posts: custom post type / taxonomyOrdered by comment count
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 } echo '<h2 class="widgettitle">top from <span>'. $tax .'</span></h2><ul>'; '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 the_permalink(); echo '" title="'; echo the_title(); echo'"><div class="comment-img">'; echo the_post_thumbnail('thumbnail'); echo '</div></a>'; echo '<a class="title" href="'; echo the_permalink(); echo '" title="'; echo the_title(); echo '">'; echo the_title(); echo '</a>'; echo '<div class="author">'; echo '<span>'. the_time(get_option('date_format')) .' by: </span>'; echo the_author_posts_link(); echo '</div>'; endwhile; endif; wp_reset_query(); echo '</ul>'; echo '</div>';
以上是关于热门帖子:按评论计数自定义帖子类型/分类法的主要内容,如果未能解决你的问题,请参考以下文章