Skip to content

Instantly share code, notes, and snippets.

@abackstrom
Created October 6, 2010 14:55
Show Gist options
  • Save abackstrom/613475 to your computer and use it in GitHub Desktop.
Save abackstrom/613475 to your computer and use it in GitHub Desktop.
function mediawiki_page( $atts ) {
$title = urlencode($atts['title']);
if( false === ( $content = get_transient( 'mediawiki_' . $title ) ) ) {
$url = 'http://wiki.sixohthree.com/w/index.php?title=' . $title . '&action=render';
$response = wp_remote_get($url);
$content = $response['body'];
set_transient( 'mediawiki_' . $title, $content, 600 );
}
return $content;
}
add_shortcode('mediawiki', 'mediawiki_page');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment