目的是,不同的分类栏目页的侧边栏调用不同的热门文章,实现代码如下: <?php global $wp_query; $cat_ID = get_query_var('cat'); $catnew = $cat_ID; $args = array( 'cat' => $catnew, 'showposts' => 10, 'child_of' => 0, 'orderby' => meta_value_num, 'meta_key' => views, ); query_posts($args); while(have_posts()): the_post(); ?> <li><img <?php the_post_thumbnail( array(60,60) ); ?><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li> <?php endwhile; wp_reset_query(); ?> 当然了,样式需要自己添加了。 未经允许不得转载:泥人传说 » wordpress分类栏目页的侧边栏调用当前分类热门文章的代码 侧边栏调用当前分类的热门文章列表栏目分类调用热门文章列表调用当前分类的热门文章列表 分享到: 赞(0)