Support » Plugin: Posts in Sidebar » enable cache for shortcode

  • Resolved vfans

    (@vfans)


    Hi!
    Is there a way to enable cache function for shortcode ?
    I tried these following code on a page but not working ,the contents of this querry still changed after refresh the page.
    [pissc number=3 orderby=rand cache=3600]
    [pissc number=3 orderby=rand cache=1]

    or it’s just can’t ?

    Thanks!

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Aldo

    (@aldolat)

    Hi,
    the correct shortcode is:

    [pissc number=3 orderby="rand" cached=1 widget_id="my_id"]

    or, starting from 4.8.4 version (that will be released soon):

    [pissc number=3 orderby="rand" cached=1 shortcode_id="my_id"]

    Let me know, please.

    wow! it worked.

    I used this shortcode:
    [pissc number=3 orderby=”rand” cached=1 widget_id=”my_id”],
    and the results are cached perfectly even I dont real understand the meaning of [widget_id=”my_id”] is.😅

    BTW, I think [cached=1] is just a trigger for enable this function, But not a timer, Right?

    so I was wondering how to set a cache-expires-timer for shortcode as same as theme’s widget did?

    looking forward to version 4.8.4.

    Thanks a lot.

    Plugin Author Aldo

    (@aldolat)

    Hello!

    the results are cached perfectly even I dont real understand the meaning of [widget_id=”my_id”] is.

    This is the ID for that widget. It is mandatory only if you are using more than one Posts in Sidebar shortcode in your site, in order to avoid conflicts.

    The ID is used to uniquely identify a single shortcode. It is useful for two reasons:
    1) store the information for that shortcode in the database;
    2) identify a shortcode in the rendered page on the front end, so that you can use precise CSS styles.

    When you create a shortcode, use a unique ID for each shortcode.

    BTW, I think [cached=1] is just a trigger for enable this function, But not a timer, Right?

    The timer is defined by another option, cache_time:

    [pissc number=3 ignore_sticky=1 orderby="rand" cached=1 cache_time=86400]

    For a more comprehensive explanation, I updated the wiki of this plugin. See the cache section for the shortcode.

    By the way, I just uploaded the new 4.8.4 version to the wild. 🙂

    Please, let me know!

    Brilliant! That’s all I needed.

    Define a unique shortcode ID truly helpful if I want doing some makeup after then.👍

    Thank you Aldo!

    Plugin Author Aldo

    (@aldolat)

    You are very welcome!

    As I wrote in my first post, do not use the option widget_id but shortcode_id.

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