Hello.
Is it possible to display the post visits number somewhere in the post? I can see the “avada_post_views_count” in custom fields, but I want to be sure how to use it. Many thanks.
I stumbled across this thread while trying to figure out how to change the Post Views count for individual posts — so I can change what the Avada Top Posts widget displays as popular.
I figured out how to change the Post View count for any particular post.
1. Install “Show IDs” plugin by 99 Robot. That will give you the Post ID number for each post in the Admin dashboard
2. In phpMyAdmin, run this query:
SELECT * FROM wp_postmeta WHERE meta_key LIKE ‘avada_post_views_count’ ORDER BY wp_postmeta.post_id ASC
This will grab the avada_post_views_count and sort it by the Post ID.
3. Change the Post ID’s meta_value to the view count you want it to be
Scratch the last query… I’m not a SQL guy and can’t figure out today how to get the Post Title and Post ID. The “ID” in the previous query does not correspond to the Post ID in my database. Perhaps someone else can provide a better way to get Post Title and Post ID.
After changing the post view counts so the Avada “Popular/Recent/Comments” widget now shows the most popular articles based on Google-tracked views, I went on a few computers to see whether the avada_post_views_count got updated for the 2nd most popular article. I wanted to see if it would jump to #1. It did not.
I am using Avada 7.2.1, and it seems that the theme no longer tracks view counts for posts. Is that correct, Theme Fusion team? If yes, that would make the “Popular” widget based on Views no longer useful.
Some additional things I have learned since my last reply.
So a post can have its counter incremented whenever somebody viewed it, its ‘avada_post_views_count’ CANNOT be 0. Change it to 1. Subsequent visits will then start incrementing the value. The reason why my past tests did not have a post’s view count go up appears to be because its value was 0. Posts with meta_value of 0 do not appear to have it incremented with each view.
To see all posts that have a 0 count:
SELECT * FROM wp_postmeta WHERE meta_key LIKE ‘avada_post_views_count’ AND meta_value=0 ORDER BY post_id DESC
To update all posts with 0 count to 1: (Be VERY careful with this!)
UPDATE wp_postmeta SET meta_value=1
WHERE meta_key LIKE ‘avada_post_views_count’ AND meta_value=0
To see posts with the most views:
SELECT * FROM wp_postmeta WHERE meta_key LIKE ‘avada_post_views_count’ ORDER BY meta_value DESC
Avada › Forums › Community Forum › Post views count
Tagged: post view count change title author comment