WordPress文章点赞量排行文章
这是一条文章内容页公告,可在后台开启或关闭,此处可使用html标签...
WordPress文章点赞功能相信大家已经能够实现了,那么该怎么获取到文章点赞数量、和文章点赞排行文章呢?
这篇WordPress教程为你揭晓:
其实WordPress文章点赞量排行的实现原理跟获取最新文章、热门文章大同小异,只添加了’meta_key’ => ‘dotGood’ 字段,具体方法请看下面代码:
<?php
$args = array(
'ignore_sticky_posts' => 1,
'meta_key' => 'dotGood',
'orderby' => 'meta_value_num',
'showposts' => 20
);
query_posts($args); if ( have_posts() ) : ?>
<?php while ( have_posts() ) : the_post(); ?>
<a href="<?php the_permalink(); ?>" rel="external nofollow" rel="external nofollow" target="_blank"><?php echo mb_strimwidth(get_the_title(), 0, 46,'…'); ?></a>
<?php endwhile; endif;?>
使用方法
将上面代码放到需要调用文章点赞量排行的页面,修改样式即可。

UI掌控:cinui_
关注我们,获取更多的全网素材资源有趣有料!