Skip to content

Instantly share code, notes, and snippets.

@thomasgriffin
Created May 25, 2012 16:04
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thomasgriffin/2788954 to your computer and use it in GitHub Desktop.
Save thomasgriffin/2788954 to your computer and use it in GitHub Desktop.
<?php
/** Store oEmbed results in a transient */
if ( false === ( $tweets = get_site_transient( 'tgm_get_tweets' ) ) {
$tweets = wp_oembed_get( $url, $args );
if ( ! $tweets ) // wp_oembed_get returns false on failure
$tweets = *get your old tweets from here*;
set_site_transient( 'tgm_get_tweets', $tweets, 60*60*24 );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment