Title: WPP Shortcode
Last modified: May 26, 2022

---

# WPP Shortcode

 *  Resolved [deeveearr](https://wordpress.org/support/users/deeveearr/)
 * (@deeveearr)
 * [4 years ago](https://wordpress.org/support/topic/wpp-shortcode/)
 * 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)

1 [2](https://wordpress.org/support/topic/wpp-shortcode/page/2/?output_format=md)
[3](https://wordpress.org/support/topic/wpp-shortcode/page/3/?output_format=md) 
[→](https://wordpress.org/support/topic/wpp-shortcode/page/2/?output_format=md)

 *  Plugin Author [Hector Cabrera](https://wordpress.org/support/users/hcabrera/)
 * (@hcabrera)
 * [4 years ago](https://wordpress.org/support/topic/wpp-shortcode/#post-15681184)
 * Hi [@deeveearr](https://wordpress.org/support/users/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?](https://github.com/cabrerahector/wordpress-popular-posts/wiki/5.-FAQ#is-wordpress-popular-posts-compatible-with-caching-plugins):
 * > … if you’re using the [[wpp] shortcode](https://github.com/cabrerahector/wordpress-popular-posts/wiki/1.-Using-WPP-on-posts-&-pages)
   > or the [wpp_get_mostpopular() template tag](https://github.com/cabrerahector/wordpress-popular-posts/wiki/2.-Template-tags#wpp_get_mostpopular)
   > 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](https://wordpress.org/support/users/hcabrera/)
 * (@hcabrera)
 * [4 years ago](https://wordpress.org/support/topic/wpp-shortcode/#post-15681199)
 * Also, please note that `last1days` isn’t a valid Time Range option 😛 (see [Parameters](https://github.com/cabrerahector/wordpress-popular-posts/wiki/2.-Template-tags#parameters)
   for a full list of accepted Time Range values).
 *  Thread Starter [deeveearr](https://wordpress.org/support/users/deeveearr/)
 * (@deeveearr)
 * [4 years ago](https://wordpress.org/support/topic/wpp-shortcode/#post-15681447)
 * 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](https://wordpress.org/support/users/hcabrera/)
 * (@hcabrera)
 * [4 years ago](https://wordpress.org/support/topic/wpp-shortcode/#post-15681537)
 * 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](https://wordpress.org/support/users/deeveearr/)
 * (@deeveearr)
 * [4 years ago](https://wordpress.org/support/topic/wpp-shortcode/#post-15681570)
 * 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](https://cabrerahector.com/wordpress/how-to-make-a-grid-of-popular-posts-with-thumbnails/)
   into my theme’s stylesheet, but no joy I’m afraid.
 * Is the CSS still working?
 *  Plugin Author [Hector Cabrera](https://wordpress.org/support/users/hcabrera/)
 * (@hcabrera)
 * [4 years ago](https://wordpress.org/support/topic/wpp-shortcode/#post-15681711)
 * Last time I checked, yes, it should be working.
 * This `[widget id="wpp-24"]` however is coming from [Widget Shortcode](https://wordpress.org/plugins/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 4 years ago by [Hector Cabrera](https://wordpress.org/support/users/hcabrera/).
      Reason: Reworded for clarity
 *  Thread Starter [deeveearr](https://wordpress.org/support/users/deeveearr/)
 * (@deeveearr)
 * [4 years ago](https://wordpress.org/support/topic/wpp-shortcode/#post-15681791)
 * 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](https://wordpress.org/support/users/hcabrera/)
 * (@hcabrera)
 * [4 years ago](https://wordpress.org/support/topic/wpp-shortcode/#post-15681870)
 * If you’re using the [wpp] shortcode with the Block editor then that’s a [known issue](https://github.com/cabrerahector/wordpress-popular-posts/wiki/1.-Using-WPP-on-posts-&-pages#the-wpp-shortcode-and-the-block-editor-aka-gutenberg)
   and you should be using the [WordPress Popular Posts block](https://github.com/cabrerahector/wordpress-popular-posts/wiki/1.-Using-WPP-on-posts-&-pages#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](https://wordpress.org/support/users/deeveearr/)
 * (@deeveearr)
 * [4 years ago](https://wordpress.org/support/topic/wpp-shortcode/#post-15681897)
 * 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](https://wordpress.org/support/users/hcabrera/)
 * (@hcabrera)
 * [4 years ago](https://wordpress.org/support/topic/wpp-shortcode/#post-15681943)
 * 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 4 years ago by [Hector Cabrera](https://wordpress.org/support/users/hcabrera/).
      Reason: Added missing parameters to the revised shortcode
 *  Thread Starter [deeveearr](https://wordpress.org/support/users/deeveearr/)
 * (@deeveearr)
 * [4 years ago](https://wordpress.org/support/topic/wpp-shortcode/#post-15682052)
 * 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](https://wordpress.org/support/users/hcabrera/)
 * (@hcabrera)
 * [4 years ago](https://wordpress.org/support/topic/wpp-shortcode/#post-15682155)
 * 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](https://wordpress.org/support/users/deeveearr/)
 * (@deeveearr)
 * [4 years ago](https://wordpress.org/support/topic/wpp-shortcode/#post-15682210)
 * I’ll just make the page live, and let you know…
 *  Thread Starter [deeveearr](https://wordpress.org/support/users/deeveearr/)
 * (@deeveearr)
 * [4 years ago](https://wordpress.org/support/topic/wpp-shortcode/#post-15682231)
 * Ok so the test page is now live [HERE](https://midlandsmaidens.com/demo-page/)
 *  Thread Starter [deeveearr](https://wordpress.org/support/users/deeveearr/)
 * (@deeveearr)
 * [4 years ago](https://wordpress.org/support/topic/wpp-shortcode/#post-15682298)
 * 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)

1 [2](https://wordpress.org/support/topic/wpp-shortcode/page/2/?output_format=md)
[3](https://wordpress.org/support/topic/wpp-shortcode/page/3/?output_format=md) 
[→](https://wordpress.org/support/topic/wpp-shortcode/page/2/?output_format=md)

The topic ‘WPP Shortcode’ is closed to new replies.

 * ![](https://ps.w.org/wordpress-popular-posts/assets/icon-256x256.png?rev=1232659)
 * [WP Popular Posts](https://wordpress.org/plugins/wordpress-popular-posts/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wordpress-popular-posts/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wordpress-popular-posts/)
 * [Active Topics](https://wordpress.org/support/plugin/wordpress-popular-posts/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wordpress-popular-posts/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wordpress-popular-posts/reviews/)

## Tags

 * [ajax](https://wordpress.org/support/topic-tag/ajax/)
 * [caching](https://wordpress.org/support/topic-tag/caching/)
 * [shortcode](https://wordpress.org/support/topic-tag/shortcode/)

 * 37 replies
 * 2 participants
 * Last reply from: [Hector Cabrera](https://wordpress.org/support/users/hcabrera/)
 * Last activity: [4 years ago](https://wordpress.org/support/topic/wpp-shortcode/page/3/#post-15688056)
 * Status: resolved