• Resolved Okoth1

    (@okoth1)


    Hi Hector,

    Right now I’m getting the yearly views (including the removal of the comma for numbers above 1000) with

    $a =  wpp_get_views( get_the_ID(), 'yearly');
    if(preg_match("/^[0-9,]+$/", $a)) $a = str_replace(',', '', $a);

    I have added the yearly cases in wordpress-popular-posts.php. It all works well, until your next update of course.

    Is there a better way to add the yearly case?

    https://www.ads-software.com/plugins/wordpress-popular-posts/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Hector Cabrera

    (@hcabrera)

    Hi there!

    Is there a better way to add the yearly case?

    Unfortunately, no. At the time there’s no other way around than modifying the code directly. I am planning to add the ability to set custom time ranges on a future version, though. Until then, you’ll have to patch the code after every update.

    … including the removal of the comma for numbers …

    The wpp_get_views() template tag actually has a third parameter for this (it wasn’t documented for some reason, just updated the wiki).

    Thread Starter Okoth1

    (@okoth1)

    Thanks Hector. I’m going to have a look at the third parameter.

    Thread Starter Okoth1

    (@okoth1)

    Which I just did, and it’s way easier. Thanks

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Showing yearly stats’ is closed to new replies.