wp-postviews icon indicating copy to clipboard operation
wp-postviews copied to clipboard

Incrementation not working for mobile

Open liogate opened this issue 6 years ago • 4 comments

Hello,

I'm running into an issue with the plugin on the counter. When I refresh a post 10 times on my desktop, it works like a charm, my post has 10 more views. But when i'm accessing to the same post on my phone, nothing happens.

There's no cache plugin installed.

Thank you for your help !

liogate avatar Sep 19 '19 12:09 liogate

If you have a separate mobile theme, your theme might be missing the wp_head function

lesterchan avatar Sep 19 '19 12:09 lesterchan

@lesterchan the same theme is used for the both situations: smart-mag is used here.

liogate avatar Sep 19 '19 13:09 liogate

I am not sure because the logic is the same on the plugin side. There is no special code for mobile. So my guess your theme is not handling something probably if it is rendering the mobile view.

This plugin uses the wp_head action to count the views https://github.com/lesterchan/wp-postviews/blob/master/wp-postviews.php#L49. You might need to check on the theme author.

lesterchan avatar Sep 19 '19 13:09 lesterchan

Thank you for your answer. May be the plugin should offer a switch to call the incrementation function from the frontend or backend ?

https://github.com/lesterchan/wp-postviews/commit/19e8a5afa228989dead2cf2c97d38e58787ba3d2#diff-0fabc5a24043340164e103873f80a77bL88

liogate avatar Sep 19 '19 13:09 liogate