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 badges1 Answer
Reset to default 0The 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