• Resolved thethunderbird99

    (@thethunderbird99)


    I have a shortcode which passes a dynamic variable in for the category parameter. Is it possible to use a cache on such a shortcode with the caching add-on?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Darren Cooney

    (@dcooney)

    Hi @thethunderbird99,
    Yes that is possible.

    You just need to make sure you have a unique cache_id for each category.
    Like the following:

    
    $cat = get_the_category();
    $cat = $cat->slug;
    echo do_shortcode('[ajax_load_more cache="true" cache_id="category-'.$cat.'" category="'.$cat.'"]');
    
    Plugin Author Darren Cooney

    (@dcooney)

    Revised code… The query above was incorrect ??

    $cat = get_query_var('cat');
    $category = get_category ($cat);
    $slug = $category->slug;
    echo do_shortcode('[ajax_load_more cache="true" cache_id="category-'.$slug.'" category="'.$slug.'"]');
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Caching Dynamic Shortcode’ is closed to new replies.