• Resolved NAROLLES

    (@narolles)


    Hello Hector
    I hope you are doing well and in good health
    After yesterday’s update
    I have a little problem
    I think this concerns the wpp_get_views () tag
    I have a shorcode to display on each post the number of views
    like the link for example

    Since the update …. it only takes the views I think of 24 hours and not all
    https://github.com/cabrerahector/wordpress-popular-posts/wiki/2.-Template-tags
    here I read
    Time range (string / array, optional). If time range isn’t provided, wpp_get_views () will retrieve the total amount of views.
    is this a problem with my function or with the update?
    Thank you

    function wpp_viewcounter ($option)
      {
    if (function_exists("wpp_get_views") )
                                      {
                                       $nbView = wpp_get_views(get_the_ID());
                                       $iNbView = intval(preg_replace("/[^0-9]/","",$nbView));
                                       echo colorCounterView($iNbView);
                                      }
      }
    
    add_shortcode('wpp_counter_view', 'wpp_viewcounter');
    
    function colorCounterView($number)
        {
         $counterColorBegin="";
         $counterColorEnd="";
         $num= intval(preg_replace("/[^0-9]/","",$number));
         if ($num >100)
           {
            $counterImportant = "";
            if ($num >100) {$counterImportant = '-normal';}
            if ($num >300) {$counterImportant = '-good';}
            if ($num >500) {$counterImportant = '-verygood';}
            if ($num >1000) {$counterImportant = '-important';}
            if ($num >2000) {$counterImportant = '-veryimportant';}
    
            $counterColorBegin='<span class="eye-counter-color'.$counterImportant.'">';
            $counterColorEnd='</span>';
           }
           else {
              if (strlen($number)> 4) {
              $counterImportant = '-veryimportant';
              $counterColorBegin='<span class="eye-counter-color'.$counterImportant.'">';
              $counterColorEnd='</span>';
              }
           }
         return $counterColorBegin . $number . $counterColorEnd;
        }

    The page I need help with: [log in to see the link]

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

    (@hcabrera)

    Hi @narolles,

    If time range isn’t provided, wpp_get_views () will retrieve the total amount of views.

    Ah, you’re right. Oops!

    For the time being please change:

    $nbView = wpp_get_views(get_the_ID());

    to:

    $nbView = wpp_get_views(get_the_ID(), 'all');

    That will restore the previous behavior and show total views count. I’ll push an update to revert that change soon.

    Thanks for the heads-up!

    Thread Starter NAROLLES

    (@narolles)

    Hello
    and thank you for this quick reaction
    I go back in the next update?

    Plugin Author Hector Cabrera

    (@hcabrera)

    Yes, you can undo this change once the new release is out (hopefully within the next 24 hours or so) or you can just leave it as it is. It shouldn’t really matter.

    OMG. My heart just stood still. Alle my views are gone. I hope this can get fixed soon as the views are an important part for all my authors on my blog https://www.videospielgeschichten.de

    Yes I noticed this too. Will await the fix.

    Plugin Author Hector Cabrera

    (@hcabrera)

    Version 5.3.1 is out! Please update as soon as possible.

    @newslicer @ispreview if you’re still having issues with the plugin -as I’m not sure that your problem is related to what the OP reported here, you didn’t share much details- please open a new topic and explain what’s going on so I can help out.

    Dear @hcabrera

    thanks so much for the fast help here. The problem is SOLVED.

    I’m using

    wpp_get_views(get_the_ID())

    in my PHP file to show the views.

    Great support! And let me tell you: this is a wonderful plugin, that quick became essential for my website.

    Cheers
    André

    Thread Starter NAROLLES

    (@narolles)

    Hello
    `Thank you Hector for your responsiveness and for the mention

    • This reply was modified 3 years, 11 months ago by NAROLLES.
    • This reply was modified 3 years, 11 months ago by NAROLLES.
    • This reply was modified 3 years, 11 months ago by NAROLLES.
    • This reply was modified 3 years, 11 months ago by NAROLLES.
    • This reply was modified 3 years, 11 months ago by NAROLLES.
    • This reply was modified 3 years, 11 months ago by NAROLLES.
    Plugin Author Hector Cabrera

    (@hcabrera)

    I’ll have a look at that once I’m off work, @narolles. I’ll keep you posted.

    Plugin Author Hector Cabrera

    (@hcabrera)

    On a second thought, yes, please open a new topic explaining in detail how to reproduce the issue so I can look into it @narolles.

    Hello there. i jus updated the las t version of the plugging an lost all my views. the counter is not working any more. So im not a profetional programer so, can you be more specific about where exactly is this code that you tall about??? wpp_get_views(get_the_ID()). help please i lost all the views. thanks

    Plugin Author Hector Cabrera

    (@hcabrera)

    Hi @manuelsanchezmx,

    Don’t worry about it. I’ll push an update in a couple of minutes that will include these changes. Just upgrade and you’ll be good to go.

    Hello there, just update last Versión 5.3.2 and still have the same problem. Does NOT views conter works. So i lost all my views and counter is not working any more. my theme support told me that the issue is becouse of the pluggin. Can you help??

    my site: https://lenguamagazine.com

    thanks.

    Plugin Author Hector Cabrera

    (@hcabrera)

    Problem might be something else then, @manuelsanchezmx. Please open a new topic and share details about your website (URL, active plugins, etc) so I can help out.

Viewing 14 replies - 1 through 14 (of 14 total)
  • The topic ‘Count viewer afterr update no work’ is closed to new replies.