这组代码用通用型的,可以放到小工具的公共侧边栏部分,这样就可以做到了不同的分类列表页的侧边栏调用的都是当前分类的热门排行榜,不会的分类都是调用的各自分类的热门排行榜。
代码如下:
<h4><i class="fa fa-window-minimize fa-rotate-90"></i>热门排行榜</h4>
<ul id="work_list_hot">
<?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><a href="<?php the_permalink(); ?>" title="<?php the_title();?>"><?php the_title();?></a></li>
<?php endwhile; wp_reset_query(); ?>
</ul>
样式代码就没有帖出来了,你们可以自己去DIY样式。
如果有什么需要交流的,可以在下方留言评论。
本人原创代码,若要转载请注明此文的出处。谢谢!







![Mysql innodb 系统表损坏带来的问题[Warning] InnoDB: Cannot open table XXX/wp_downloads from the internal data dictionary of InnoDB though the .frm file for the table exists. 终极解决办法](https://nrcs.xyz/wp-content/themes/begin/prune.php?src=https://nrcs.xyz/wp-content/uploads/2023/09/e4165-2023-09-28_102533.png&w=280&h=210&a=&zc=1)




评论