lesterchan / wp-postviews

Enables you to display how many times a post/page had been viewed.
https://wordpress.org/plugins/wp-postviews/
114 stars 42 forks source link

Incrementation not working for mobile #40

Open liogate opened 5 years ago

liogate commented 5 years ago

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 !

lesterchan commented 5 years ago

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

liogate commented 5 years ago

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

lesterchan commented 5 years ago

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.

liogate commented 5 years ago

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