Use this instead of the line in wich you define $days
(your second line):
$transient = get_transient( 'your_transient_key' );
if( !$transient ):
$days = file_get_contents( 'json_file' );
set_transient( 'your_transient_key', $days, DAY_IN_SECONDS*7 );
else:
$days = $transient;
endif;
$days = json_decode( $days );
...
May be a bit rough but you get the idea.
Related Posts:
- Is using custom table to suit business needs instead of transients a big hit to page load speed?
- passing markup thought a shortcode attribute
- Shortcode Strategy
- How to cache a custom API call?
- Need help in setting up a transient using API Key and if possible updating it in the ACF field
- Impossible to display modification in shortcode code?
- How to disable cache for the content returned by a shortcode
- Custom shortcode being executed when saving page in wp-admin
- Change appearance of shortcode text inside editor
- Is there any danger in deleting all transients?
- Using transients in conjunction with memcached
- Combining shortcode and get_template_part
- Escaping quotes from shortcode attributes
- Shortcode output always showing at top of page
- How to detect if a Shortcode is being called on a page?
- How to get current page title inside a page itself in a shortcode and in page content
- shortcode inside another shortcode
- Videos via the video shortcode are always 640px wide?
- Should the caching of WordPress menus be specific to each page?
- shortcode not working [closed]
- Do not show child pages of child pages
- How to: How do I make my own shortcodes without plugins?
- Adding span tags within wp_list_pages list items
- Change font-size within a shortcode
- How to make shortcode output display where I choose
- Add Shortcode to a Div or Header [closed]
- change wordpress gallery shortcode to slider
- How to change the page break numbering?
- Allow shortcode in the author bio textarea
- WordPress display image link in shortcode
- How do I combine my shortcodes?
- Bulk converting shortcodes to blocks with embeds
- How to add source code into wordpress post really?
- stop shortcode stripping in category and archive pages
- Make shortcode’s Bootstrap CSS override the theme’s CSS, how?
- Enumeration Contact form using database table’s numbe of rows [closed]
- Change the default video shortcode
- How to use shortcode in js url
- How to add AJAX in a custom PHP function using Google sheets API
- Shortcode function executed twice?
- WordPress TinyMCE : Get value of popup button
- wp_editor in thickbox
- Using _e() on text inside video tags prints that text, instead of only showing when html5 element is not supported
- How to use the same shortcode with different attribute values on same page
- Youtube shortcode
- WordPress messes up with data attributes in shortcode output
- Shortcode will not pass attribute through to my function [duplicate]
- WordPress post pagination continuous [duplicate]
- custom field value as shortcode parameter
- How to edit blog page in wordpress? there is no place to put shortcode
- How to transform WordPress user role code to WP shortcode?
- Shortcode don’t work in custom option field, any solution?
- Slow page Loads When Using Dynamic Coding
- Can I use shortcodes in mail body
- Query to list all galleries under a parent post?
- Adding the username into a URL to redirect to a specific page
- Shortcode Help Needed → attributes
- Video Shortcode & Video Poster Question
- How to use a nested shortcode to render the value of an attribute in parent shortcode
- ob_get_clean(); doesn’t return $value in shortcode?
- Ordering get_terms with ACF not displaying all terms
- Different ID in every shortcode
- Unique ID for WordPress shortcodes when used more than once on a page?
- Which wordpress function is the caption shortcode linked to?
- Content between shortcodes
- Parsing a shortcode through an author meta textfield
- Adding YouTube button to TinyMCE editor
- Shortcode strips formatting and returns at content top
- do_shortcode within a shortcode
- tiny_mce_before_init preventing custom shortcode icon appearing
- Custom Fields – Boolean Display of True/False to Yes/No
- Twitter bootstrap tabs
- Build Clickable Link Using Multiple Attributes
- Using Shorcodes in Sharing Preview and Notifications Title from Post Title
- Echo Extra Shortcode HTML to wp_foot
- Is the WP audio shortcode still relevant?
- If statement shortcode
- Shortcode not working when I output data from wpdb html table row
- update_metadata() appends shortcode data for every page refresh
- Gallery shortcode is empty but magically creates a gallery
- Display tags cloud from a specific category ID with a shortcode
- How to avoid one code multiple times instead do that through some function? Shortcode, but I think shortcode is not used in main theme’s core files?
- Shortcode appeared twice on page, one time before content, one time where it’s really called
- Add a shortcode in woo-function.php
- Get current category and place it in shortcode
- Woocommerce products shortcode specific order
- Modify Blog Module layout in Child theme
- Inserting a variable into a shortcode inside php
- Output html source tags inside shortcode
- How can I define the output of shortcode attribute value?
- Using shortcodes that wrap around code
- Shortcode for Admin Theme Option?
- Clarify: Enqueueing scripts within shortcode only loads in footer?
- What is the best way to include a template file within a shortcode?
- What makes a placeholder resizable in Tinymce?
- Does anyone recognize shortcode ig_special_heading?
- How to scroll to a shortcode-generated anchor
- add post type pram to wp shortcode
- How can I wordpress cache a database request with no existing plugin?
- How to use multiple values in “Shortcode”? [closed]