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\" target=\"_blank\"><?php echo mb_strimwidth(get_the_title(), 0, 46,\'…\'); ?></a><?php endwhile; endif;?>