Support » Plugin: WordPress Popular Posts » Only posts, not pages

  • Resolved gormley


    I noticed a glitch that is occurring between posts and pages. I have the widget set to the following:

    – show 3 posts
    – “filters” — “post type” is set to “post”

    this works on the site as it only shows posts but if a page has one of the top 3 views in the database the widget only shows 2 popular thumbnails. it is not showing the page that is popular but it is taking one of the spots in the database and thumbnail areas.

    this also happens if the top 3 entries under stats in the plugin are pages and not posts… the site then shows nothing as it is ignoring the pages but still taking up the space where a post should be showing.

Viewing 12 replies - 1 through 12 (of 12 total)
  • Plugin Author Héctor Cabrera


    Hi gormley,

    The plugin excludes pages in the DB query, not after getting the results so there’s no “missing position”. Same goes for the Stats.

    Also, keep in mind that the limit parameter will retrieve up to X results.

    hi hector,

    when i view the plugin stats it definitely is monitoring page views along with post views.

    our “about” page has the most views of any page or post. while it is not showing in the widget area, the sidebar has cut down to showing only 2 of the popular posts that are in the #2 and #3 position after our about page.

    the widget is set to show the 3 most popular based on views. when the top 3 in the stats are POSTS the widget shows 3 like it should.

    Plugin Author Héctor Cabrera


    WPP always monitors views, no matter if you’re excluding pages or not. Please read again what I posted earlier.

    i understand that… maybe i should ask it this way…

    how do make the proper amount of popular


    appear in the widget (in this case 3) if one of the top 3 views is a page and not a post?

    i have identified “post” in the widget filter. but it is only showing 2 posts as 1 is a page that is told not to show.

    Plugin Author Héctor Cabrera


    For that, you simply need more posts viewed by your visitors. If only 2 posts meet the specified requirements (just posts, and whatever other settings you have set), then WPP will just list those two entries. If you want to display three entries, you need more posts that meet the configuration set by you.

    i have dozens of posts that are in the database… for instance of the top 10 visited pages 9 are actual blog POSTS… the top one is a PAGE. the sidebar should be showing 3 popular posts pulling from the top 3 visited items and ignore the PAGE… but because one is a PAGE and i have set your widget to filter only to show posts the widget then only shows 2 POSTS.

    i don’t think you’re fully understanding the issues or i am not explaining it correctly.

    instead of the widget database ignoring the PAGE that has the most visited it identifies as a top 3 item… BUT it ignores it when showing on sidebar widget… basically it is hidden and the widget thinks it is showing 3 but it only shows 2…. a soon as that PAGE (About Us) drops below the top 3 visited the widget then properly shows the top 3 POSTS.

    Plugin Author Héctor Cabrera


    You know, writing in caps is really rude and I don’t like that at all. Please be more polite next time or I’ll start ignoring your posts.

    About the topic in discussion, you seem not to understand what I meant when I said: “(…) The plugin excludes pages in the DB query, not after getting the results (…)”. Before building the actual list, WPP queries the database using the selected option and then creates the popular list from the returned results. So, if you set WPP to ignore pages these are excluded in the query -before creating the list- and asks WordPress to return X results at max. If only 9 posts meet the criteria (most viewed / commented in the past X time range), then 9 posts will be listed and not 10.

    Hope that clarifies things a bit.


    sorry if misinterpreted my caps as rude. it was meant to differentiate the post from the pages as many that use wordpress sometimes do from my experience (underline wasn’t working in my posts). obviously, i didn’t use caps for anything else in my post and they were strictly for visual emphasis and separation as the discussion had got confusing. do keep in mind hector that i have helped a number of people with your plugin by directing them in the right direction when i could answer one of their questions. so i have zero intentions of trying to incite, as i love the plugin and the support you give everyone, i hope you know that.

    anyway, so basically the answer is that if a page falls into the top views the site will show 1 less thumbnail in the sidebar than commanded to and there is no way around that?

    oh wait, sorry, you’re awesome hector! 🙂 😉

    Plugin Author Héctor Cabrera


    Yeah, I’m aware of that and I believe I have never said thank you for helping others out – so thank you!

    And no, that’s not the answer 😛 Pages are excluded even before building the list and WPP will still try to get as many posts as the user have requested: if 10 are available, 10 will be listed – no matter if these are posts or pages, just posts, just pages, or just custom-post-type entries.

    For a deeper analisys I’d need to check your WPP DB tables in order to give you a more detailed explanation.

    Oh, and I understand you were just trying to emphasize the idea, and I took it as yelling. No harm done 🙂

    hector, i’m glad you understand my intention. 🙂

    i completely get what you are explaining but maybe you can take a look at these screen shots which will better communicate my issue.

    top 3 views – 2 are posts, 1 is a page

    what shows on the sidebar:
    only 2 thumbs

    widget settings
    “show 3” filter only “posts”

    i hope this goes through and the images are accessible to you.

    Plugin Author Héctor Cabrera


    Hi gormley,

    It’s been a while! A quick follow-up to this discussion: I’ve been messing around with the plugin and I believe you were right, so my apologies (I can be a bit stubborn sometimes hehe). A new version has been uploaded that should fix this, so please give it a try and let me know the results.

    Hi Hector,

    No worries.

    Thanks for your continuing attention to this issue and your ongoing updates. Your plugin is very helpful to a vast amount of individuals.

    Unfortunately, the site I was having issues with doesn’t have a “page” as a top view so I can’t replicate the issue at the moment to test.

    What I will do is setup a test server at some point and test it out.


Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘Only posts, not pages’ is closed to new replies.