• Resolved Jim Reekes

    (@reekes)


    I’m migrating away from Top 10 to Popular Posts. I did the MyPHP migration and can confirm the WPP tables are there and their post id and page views values are correct.

    When I go to the plugin’s Stats panel, it’s all blank except for the Hall of Fame panel, which is full and accurate. It’s displaying exactly what I can see in the popularpostsdata table.

    I put the [wpp_views_count] short code on a page and it works as expected. But, [wpp] is only returning “Sorry. No data so far.” no matter what I’ve tried.

    I’m hosted at SiteGround and have added the sgo_javascript_combine_exclude_ids filter for wpp-js. I don’t use their optimizer, but instead use the Debloat plugin. This is per their recommendation, and in fact they configured it (for a fee). I also excluded wpp-js and wpp.min.js in minifying and deferring.

    I trouble shooted further and disabled all plugins and activated the Twenty Twenty-Four theme. So, even with everything disabled, [wpp] doesn’t return any data…nor does the Stats panel show anything (other than under Hall of Fame).

    Note, popularpostsdata table had inserted today’s date in each of the 4000+ rows, but then why isn’t the Stats panel showing anything?

    Then I tried viewing several post manually testing if WPP was tracking views and updating the tables. I finally got a couple of posts to appear in the Most Viewed panel. So I don’t undersatnd something about the WPP logic in the Stats. It can show posts I just looked at, but not include the thousands of posts that have tens of thousands of views in their history (even with last_viewed set to today).

    Still, even when I got a couple posts to show in the Most Viewed panel, [wpp] is still returning “Sorry. No data so far.”

    One more thing, when I added the WPP Widget for the sidebar I do get the proper list of articles (according to my settings). If I add the [wpp] short code to the widget bar, it returns “Sorry. No data so far.”

    Then I tried adding the Widget to the page (to replace using the [wpp] short code, and that worked! Huh?

    • This topic was modified 1 month, 3 weeks ago by Jim Reekes.
    • This topic was modified 1 month, 3 weeks ago by Jim Reekes.
Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Hector Cabrera

    (@hcabrera)

    Hey @reekes,

    By default the [wpp] shortcode if used without any parameters -as it seems you’re doing- will attempt to retrieve up to the 10 most viewed posts from the last 24 hours (see [wpp] shortcode for more details + docs.)

    Since you said that you don’t have anything listed under “Most Viewed” and the other tabs maybe you just haven’t received any visits yet? If so then that’s the expected output.

    To clarify:

    • The “Most Viewed” tab will list the most viewed posts from the currently selected time range (by default it’s last 7 days)
    • The “Most Commented” tab follows the same logic, except it lists the most commented ones
    • The popularpostsdata table holds the data for the Hall of Fame tab (a.k.a. total views count per post since the plugin was first installed.)
    • The popularpostsummary table holds the detailed views data per day, this is what allows the plugin to list the most viewed posts from eg. the last 24 hours, last 5 minutes, etc. If this table is empty and you’re trying to list the most viewed posts from the last 24 hours then the plugin will have nothing to show, hence “Sorry, no data so far.”

    Are you testing all this on a dev site?

    Thread Starter Jim Reekes

    (@reekes)

    Are you testing all this on a dev site?

    Yes, getting all the code in place and tested before pushing out to live.

    [wpp] shortcode if used without any parameters

    I’ve tried it without, and with several options. It always returns “no data” no matter.

    “Most Viewed” tab will list the most viewed posts from the currently selected time range (by default it’s last 7 days)

    I’ve tried it even with the last 30 days, but it wasn’t showing anything. The tables migration added the last viewed as today, so I had expected to find everything listed in any date range. But, no posts showed up in anything other than the Hall of Fame.

    Yet, since the Widget is working as expected but the [wpp] short code doesn’t no matter what parameter I tired, I’m at a loss.

    But, maybe I should just use the Widget on the page instead?

    Plugin Author Hector Cabrera

    (@hcabrera)

    The shortcode should work just fine if you want to use that. Personally I think the WPP block is easier to use for most people.

    I’ve tried it even with the last 30 days, but it wasn’t showing anything.

    Can you please show me what you tried in more detail? It’s a little hard to help with so little info.

    • Do you have any data in popularpostssummary?
    • How are you adding this shortcode to your site exactly?
    • etc

    A screen recording and/or screenshots might be helpful here.

    Thread Starter Jim Reekes

    (@reekes)

    First, I was confusing the WPP widet with the WPP block. The block is working on pages. I use Gutenberg. Only the short code wasn’t working.

    I eventually figure it out, and it was a D’oh! moment.

    I’m using a custom post and I have to add post_type (of course).

    I had that in there previously, but that was when there was nothing in the popularpostssummary table. I also tried different combination of parameters, but I must have not had post_type included with the other attempts. The other key parameter I needed is range='all'.

    Sorry for my confusion!

    The final piece of the puzzle was figuring out how to get the except to render. I couldn’t find how to do that in the docs, and tried everything. I eventually found a clue in your reply to someone else. Then going back to the main docs page, I see how this is (somewhat) hidden in there. Displaying the excerpt requires the use of post_html. Now that I understand this, I can see how this works. A couple examples would have made this obvious.

    Here’s what I ended up with:

    [wpp post_type='articles' limit='5' range='all' stats_views=0 order_by='views' excerpt_length=20 excerpt_format=0 excerpt_by_words=1 post_html='<li><span style="font-style: bold;">{title}</span><div style="font-style: italic;">{excerpt}</div></li>']

    I tried a simple <br> to separate the title and excerpt in the list’s row, but that didn’t work. I could only get that to happen using a <div>.

    Another issue I found, If I added a header it defaults to <h2> but the problem is it caused the list to appear in a new column. So tried adding header_start and header_end to change this to <h4> but that still put the list into a new column. Odd, huh? This is what I had:

    [wpp header='Popular Articles from Argon Systems' header_start='<h4>' header_end='</h4>' post_type='articles' limit='5' range='all' stats_views=0 order_by='views' excerpt_length=20 excerpt_format=0 excerpt_by_words=1 post_html='<li><span style="font-style: bold;">{title}</span><div style="font-style: italic;">{excerpt}</div></li>']

    I gave up on the idea of having the short code add a header. Instead I put it above the list separaly myself within a container. That was the trick, so now the header and list are kept together. Then, as an experiment, I wrapped just the short code within a container and it worked. The list wasn’t starting a new column. But then it was hard to see the layout within Gutenberg so I just kept the header outside of the short code. It’s more WYSIWYG that way.

    Now that I’m understanding the code within WPP, it’s really well done. There’s a lot of options in there. I suppose someone could add a bunch of UI to show off all it’s power, but then it wouldn’t be free plugin anymore ??

    Many thanks for the great plug in and fantastic support.

    Plugin Author Hector Cabrera

    (@hcabrera)

    Yeah, some of the issues you mentioned are mostly due to how WordPress parses shortcodes in general. It’s very picky and usually doesn’t know what to do when it finds HTML tags inside shortcodes. The br tag for example will be converted into a line break automatically, which may or may not be what the user -you in this case- intended.

    The excerpt thingy is a known pain point. There’s even a Github issue about it, I just keep forgetting that it’s there ??

    That’s why I think it’s just easier to use the WordPress Popular Posts block in general. Does the same thing as the shortcode and it’s more intuitive IMO.

    Now that I’m understanding the code within WPP, it’s really well done.

    Many thanks for the great plug in and fantastic support.

    Thanks for the kind words!

    I suppose someone could add a bunch of UI to show off all it’s power, but then it wouldn’t be free plugin anymore ??

    Plus it’d be a ton of work. Since this plugin is maintained for free by a single person on their spare time… There’s only so much I can do ??

    (I do take suggestions and all, and usually try to implement stuff if I consider that’s something that would benefit the vast majority of users out there.)

    Anyways, glad to know you were able to sort things out. Have a nice rest of your day!

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