Skip to content

Instantly share code, notes, and snippets.

@richerimage
Created August 16, 2014 09:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save richerimage/bcb754d6742ee6157439 to your computer and use it in GitHub Desktop.
Save richerimage/bcb754d6742ee6157439 to your computer and use it in GitHub Desktop.
Inject a file's content with a shortcode
function getfile_content( $atts ) {
extract( shortcode_atts( array(
'fileurl' => ''
), $atts ) );
if ($fileurl!='')
return @file_get_contents($fileurl);
}
add_shortcode( 'getfile', array($this, 'getfile_content'));
// how to use: [getfile fileurl="http://www.exmaple.com/somepage.html"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment