• Resolved ryanneilmed

    (@ryanneilmed)


    For some reason the shortcode is ignoring the current view counts of the posts. It’s loading in posts as if they’ve never had a single view. If you click on any of the posts, the shortcode assigns them 1 view, but on the archive page it shows the proper amount of views.

    The page I need help with: [log in to see the link]

Viewing 7 replies - 1 through 7 (of 7 total)
  • Thread Starter ryanneilmed

    (@ryanneilmed)

    I think I understand why this is happening now. These are custom post types so I’ll have to run a query in our DB to import them over into the “popularpostsdata” table? I am using the post_type filter.

    Plugin Author Hector Cabrera

    (@hcabrera)

    Hi @ryanneilmed,

    For some reason the shortcode is ignoring the current view counts of the posts. It’s loading in posts as if they’ve never had a single view. If you click on any of the posts, the shortcode assigns them 1 view, but on the archive page it shows the proper amount of views.

    You’ll need to explain a bit more in detail for me to understand what you’re talking about.

    Let’s start with these:

    • Share your shortcode
    • Show actual URLs where I can see this behavior you’re talking about
    • Explain what the problem is, expected behavior, etc.
    • Which post type(s) are we talking about exactly?

    Remember: you’re talking with someone who has zero knowledge about your project. The more context you can provide the better the chances others can help out.

    These are custom post types so I’ll have to run a query in our DB to import them over into the “popularpostsdata” table?

    No need, as long as your CPTs are publicly accessible WordPress Popular Posts will also track their page views.

    • This reply was modified 1 year ago by Hector Cabrera. Reason: Reworded for clarity
    Thread Starter ryanneilmed

    (@ryanneilmed)

    Hi Hector, thanks for getting back to me. The CPT’s are questions and answers. The view count is stored in post_meta. meta_value is the view count.

    My shortcode is:

    [wpp limit=’5′ range=’all’ post_type=’question’ order_by=’views’]

    If you navigate to dev.neilmed.com you’ll see the questions archive and the number of views for each post (column on the right).

    When you go into one of the questions, WPP is showing only recent views, not actual views. You can see the first post “Just purchased sinugator…” has 238 views. But WPP shows it only having 6 views.

    I need to have WPP pull views from post_meta table instead of popularpostsdata -> pageviews column. I hope this explanation is helpful.

    Thanks!

    Plugin Author Hector Cabrera

    (@hcabrera)

    Thanks for the extra details, Ryan.

    Question: where is this qa_view_count field coming from? Where is this qa_view_count views number coming from?

    Thread Starter ryanneilmed

    (@ryanneilmed)

    The qa_view_count is how the Question Answer plugin relates views to the questions. It is inside of the post_meta table. So anytime a new question (post) is created, a row in post_meta is created to record number of views for the new post via the post_id.

    Plugin Author Hector Cabrera

    (@hcabrera)

    Then that’s the issue: you’re comparing the data of two completely different and unrelated plugins. WordPress Popular Posts doesn’t know about Question Answer’s views data and the same thing applies the other way around.

    Either:

    • Find a way to have Question Answer use WPP’s views data so that the number matches, or
    • Build your “Popular Questions” list using Question Answer’s views data (in which case you would no longer need to use WordPress Popular Posts)
    Thread Starter ryanneilmed

    (@ryanneilmed)

    Possibly option 2…but I think I’ll just run a DB INSERT to populate the popularpostsdata table with the post id and views count from post_meta into the respective columns. Then moving forward, any new posts will be recorded views in WPP and the Question Answer plugin. Thanks for your clarity and help with this!

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Order by Views is being ignored’ is closed to new replies.