• Resolved deeveearr

    (@deeveearr)


    Hi,

    I’ve decided to use the shortcode version of WPP seeing as according to the WP Rocket documentation, shortcodes do not get cached if they use AJAX.

    I’m now having the same problems as before though, in that what’s showing is a million miles away from what is trending.

    The shortcode that I’m using (in a text widget) is:

    [wpp thumbnail_width=100 thumbnail_height=100 range='last1days' limit=5 stats_views=0 order_by='views']

    Is this correct or should it read something else?

Viewing 15 replies - 1 through 15 (of 37 total)
  • Plugin Author Hector Cabrera

    (@hcabrera)

    Hi @deeveearr,

    … shortcodes do not get cached if they use AJAX.

    Big if there. WPP’s shortcode doesn’t use AJAX ?? (at the time of writing at least). It’s even mentioned in the FAQ Is WordPress Popular Posts compatible with caching plugins?:

    … if you’re using the [wpp] shortcode or the wpp_get_mostpopular() template tag you will need to find a way to prevent your site’s page cache from caching your popular posts list because the “Ajaxify widget” option -as its name implies- can only be used by the WordPress Popular Posts widget / widget block.

    Plugin Author Hector Cabrera

    (@hcabrera)

    Also, please note that last1days isn’t a valid Time Range option ?? (see Parameters for a full list of accepted Time Range values).

    Thread Starter deeveearr

    (@deeveearr)

    Yes, I changed the parameter to last24hours to keep the trending options, but this is still way off the mark.

    The main reason that I wanted to use the shortcodes, was that I found a post last night explaining how to place posts into a grid.

    I had a mess around with it but that didn’t work either.

    By the way, the sidebar widget is working flawlessly now!

    Plugin Author Hector Cabrera

    (@hcabrera)

    If by “Trending options” you mean the “Trending” tab from WPP’s Statistics dashboard then you need to use a different time range. “Trending” lists the most viewed posts from the last hour, to get that list with the shortcode you need this instead:

    [wpp range='custom' time_quantity=1 time_unit='hour']

    Thread Starter deeveearr

    (@deeveearr)

    I’ve been trying to combine things together by combining one of the WPP widgets, and using the shortcode from that ([widget id="wpp-24"]) to place an image grid onto a test page on my website.

    I’ve added the CSS from the post on THIS PAGE into my theme’s stylesheet, but no joy I’m afraid.

    Is the CSS still working?

    Plugin Author Hector Cabrera

    (@hcabrera)

    Last time I checked, yes, it should be working.

    This [widget id="wpp-24"] however is coming from Widget Shortcode (right?), if so then you should be aware that that plugin has been abandoned for the last 2 years or so and from the comments on their support forum it seems that the plugin isn’t working very well nowadays.

    To rule out that plugin as the cause of the issue simply use the normal [wpp] shortcode and/or the widget and see what happens.

    • This reply was modified 2 years, 6 months ago by Hector Cabrera. Reason: Reworded for clarity
    Thread Starter deeveearr

    (@deeveearr)

    Yes, it’s ‘widget shortcode’ that I was trying to use.

    So placing the WPP shortcode directly into the test page:

    [wpp range='custom' time_quantity=1 time_unit='hour' post_type='post,page,portfolio,staff' limit=6 thumbnail_width=225 thumbnail_height=135 wpp_start='
    <ul class="wpp-grid">
     	<li style="list-style-type: none;">
    <ul class="wpp-grid">' post_html='
     	<li>{thumb}{title}</li>
    </ul>
    </li>
    </ul>
    ']

    …also has some strange effects, with the first post looking fine, and then the last five posts having no curved borders and sloping off to the right.

    Plugin Author Hector Cabrera

    (@hcabrera)

    If you’re using the [wpp] shortcode with the Block editor then that’s a known issue and you should be using the WordPress Popular Posts block instead.

    Another thing is that you have some line jumps in your shortcode. WordPress will automatically convert all line jumps it finds into <p> tags which will for sure mess up your HTML code.

    Thread Starter deeveearr

    (@deeveearr)

    No, I hate Guttenberg with a passion, so I’ve got ‘Disable Guttenberg’ running.

    Manually putting everything onto the same line should work then?

    Plugin Author Hector Cabrera

    (@hcabrera)

    Yep, it should.

    [wpp range='custom' time_quantity=1 time_unit='hour' post_type='post,page,portfolio,staff' limit=6 thumbnail_width=225 thumbnail_height=135 wpp_start='<ul class="wpp-grid"><li style="list-style-type: none;"><ul class="wpp-grid">' post_html='<li>{thumb}{title}</li></ul></li></ul>']

    Your HTML code though -and now that I took a closer look at it- isn’t right. It’s not structured as the tutorial says.

    Here’s the revised version (copy & pasted directly from the tutorial, just changed the Time Range related parameters):

    [wpp range='custom' time_quantity=1 time_unit='hour' post_type='post' limit=6 thumbnail_width=225 thumbnail_height=135 wpp_start='<ul class="wpp-grid">' post_html='<li>{thumb}{title}</li>']

    See the differences?

    On that note, maybe the instructions from the tutorial aren’t clear enough? If so please let me know.

    • This reply was modified 2 years, 6 months ago by Hector Cabrera. Reason: Added missing parameters to the revised shortcode
    Thread Starter deeveearr

    (@deeveearr)

    I’m not sure about the tutorial being clear enough, as I just followed it blindly to see what happened.

    Right then, I just pasted YOUR parameters into a text widget and used ‘amr Shortcode Any Widget’s new ‘Widgets For Shortcodes’ panel.

    Some progress using this new version, however, it’s not a 3×2 grid – it’s a 2x1x2x1 grid at the moment.

    Pasting the WPP shortcode directly into a page just decimates everything like before.

    Plugin Author Hector Cabrera

    (@hcabrera)

    In that case I’d have to see your page to be able to give you more suggestions / guidance.

    Also, I just remembered that there’s even a live demo in there that uses the exact same code and it even uses a [wpp] shortcode so yeah I can guarantee that the tutorial still works ??

    Thread Starter deeveearr

    (@deeveearr)

    I’ll just make the page live, and let you know…

    Thread Starter deeveearr

    (@deeveearr)

    Ok so the test page is now live HERE

    Thread Starter deeveearr

    (@deeveearr)

    Word of warning though, once more the posts are way out of sync with what’s trending.

Viewing 15 replies - 1 through 15 (of 37 total)
  • The topic ‘WPP Shortcode’ is closed to new replies.