最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

php - How to get a post views count using 'WordPress popular posts' plugin

programmeradmin0浏览0评论

I am using 'WordPress popular posts' plugin, and I'm trying to get post total views by ID using: wpp_get_mostpopular() function.

Is there anyway to achieve that? or is it even possible?

I am using 'WordPress popular posts' plugin, and I'm trying to get post total views by ID using: wpp_get_mostpopular() function.

Is there anyway to achieve that? or is it even possible?

Share Improve this question edited May 27, 2020 at 21:41 kuroyza asked May 27, 2020 at 20:58 kuroyzakuroyza 12310 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

The wpp_get_mostpopular() will give you the posts with the most views. What you want to achieve is to get the post view count by passing a post id (or using it within the loop on the single page).

There is a function which accepts post id as parameter:

<?php if ( function_exists('wpp_get_views') ) { echo wpp_get_views(get_the_ID()); } ?>

You can also show views in a specific time range. Have a look at:

https://github/cabrerahector/wordpress-popular-posts/wiki/2.-Template-tags

发布评论

评论列表(0)

  1. 暂无评论