This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Get any existing copy of our transient data | |
if ( false === ( $special_query_results = get_transient( 'special_query_results' ) ) ) { | |
// It wasn't there, so regenerate the data and save the transient | |
$special_query_results = new WP_Query( 'cat=5&order=random&tag=tech&post_meta_key=thumbnail' ); | |
set_transient( 'special_query_results', $special_query_results, 12 * HOUR_IN_SECONDS ); | |
} | |
// Use the data like you would have normally... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if ( false === ( $sidebar_popular_chartbeat = get_transient( 'sidebar_popular_chartbeat' ) ) ) { | |
$sidebar_popular_chartbeat = wp_remote_get("http://api.chartbeat.com/live/toppages/v3/?apikey=XXXXX&host=yourwebsite.com"); | |
set_transient( 'sidebar_popular_chartbeat', $sidebar_popular_chartbeat, 600 ); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$sidebar_popular_chartbeat = wnet_get_transient_remote_json('sidebar_popular_chartbeat', 'http://api.chartbeat.com/live/toppages/v3/?apikey=XXXXX&host=yourwebsite.com', 600); |
NewerOlder