Post Views Count
Problem in sorting _count-views_all (2 posts)

  1. nitman
    Posted 2 years ago #


    I'm writing a sort function and I'm having a little problem with this argument "_count-views_all".

    I'm trying to put this "&meta_key=_count-views_all&orderby=meta_value_num&order=DESC" inside query_posts() and to receive sorting category by the most views posts.

    The problem is that it is showing only the post with minimum 1 view I think its because the postmeta table receive the _count-views_all row after 1 view and if the value is 0 there is no row for the post.

    Any Idea?


  2. Eckstein
    Posted 2 years ago #

    I'm having this same problem both with this plugin and another star rating plugin that I'm using. It's actually a built-in function of WordPress that when it makes a query to the database using $meta_key it automatically doesn't show posts that don't yet have that meta key assigned to them.

    The solution is to use filters to change how wordpress is grabbing info from the database. Unfortunetely, I dont' know how to do this and have been searching around for the last couple days. If I find a useful link that helps me solve it, I'll let you know, but I thought this might at least point you in the right direction.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Post Views Count
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic


No tags yet.