Avada Forums Community Forum Post views count

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • PieroPec
    Participant
    Post count: 10

    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.

    hksscom
    Participant
    Post count: 23

    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.

    hksscom
    Participant
    Post count: 23

    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

    hksscom
    Participant
    Post count: 23

    Use this to get all Post IDs, Post Title, Comment Count, Post Date, and the Post Author’s ID:

    SELECT ID,post_title,comment_count,post_date,post_author FROM wp_posts ORDER BY wp_posts.ID ASC

    hksscom
    Participant
    Post count: 23

    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.

    hksscom
    Participant
    Post count: 23

    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.

    hksscom
    Participant
    Post count: 23

    I take the last comment back. avada_post_views_count DOES get updated, and #2 post jumped to #1 after a view visits from multiple computers.

    hksscom
    Participant
    Post count: 23

    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

Viewing 8 posts - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.