WordPress.org

Ready to get started?Download WordPress

Forums

Most And Least Read Posts Widget
[resolved] How to add an initial value to the views counter? (8 posts)

  1. Vahid
    Member
    Posted 5 months ago #

    I've already installed another plugin which shows the views value. Now I want to install this plugin and move the previous view values to this plugin. Is there a way to add an initial value to each post views separately?

    http://wordpress.org/plugins/most-and-least-read-posts-widget/

  2. whiletrue
    Member
    Plugin Author

    Posted 5 months ago #

    Hi Vahid,
    our plugin views are stored in the "custom_total_hits" custom field. You can manually add/edit the custom field inside the post edit screen, or write a SQL query to create/update these fields to the database.

  3. Vahid
    Member
    Posted 5 months ago #

    Thank you so much whiletrue. I found it so I'm marking this topic as resolved.

  4. fredwier
    Member
    Posted 3 months ago #

    Hi,

    I did not find the option to add/edit the number ov views in the post edit screen.

    Also I was looking into the database and couldn't find it also.

    Any hint ?

    Regards,

    Fred

  5. whiletrue
    Member
    Plugin Author

    Posted 3 months ago #

    Hi fredwier,
    you can edit the number of views for a single post by going to the post "edit" screen; there, locate the "custom fields" box (if not shown, enable it from the top right "screen options" button).

    Assuming that the post has at least 1 view, you'd see a "custom_total_hits" field along with the hits count; feel free to tweak it and save the post to store the values.

    If you want to operate directly on the database, the custom fields for every post should be located in the (prefix)_postmeta table.

  6. fredwier
    Member
    Posted 3 months ago #

    found it. thanks !

    But once, I've changed the number of hits and save it, the number of hits is shown correctly in the post list.

    But, the post is not shown in the "most read list".

    The look-back range is 365 days and the post is just over 30 days old. With these hits it should be in the list.

    When I change the look-back-days to 60 days, the post shows up, but not in the right order. Meaning the post has 2678 hits and is displayed between a post with 700 hits and one with close to 800 hits.

    Any idea ?

  7. fredwier
    Member
    Posted 3 months ago #

    I just changed a post which is already in the list and added an extra 1000 hits to see what happens.

    Refreshing moved that post to the correct place in the list.

    The post I described before had according to your counting 560 hits, but before installing the plug-in it is close to 2700 hits. That's why I wanted to change it.

  8. fredwier
    Member
    Posted 3 months ago #

    I tried something else and that did the trick.

    The post was original placed on november 27th. I changed that date to yesterday and refreshed.

    Now the post is in the list "most read". I changed the date back to the original date and it is still in the list on the right place.

    Maybe this helps. It isn't right, but it works.

Reply

You must log in to post.

About this Plugin

About this Topic