wordpress snippets last updated   : April 14, 2014
we now have 630 snippets

Display external files in posts using shortcode

wordpress snippet

Adding this snippet to the functions.php of your wordpress theme will allow you to include the content of an external file within your page using shortcode.

snippet :  PHPcopy
function show_file_func( $atts ) {
  extract( shortcode_atts( array(
    'file' => ''
  ), $atts ) );
  if ($file!='')
    return @file_get_contents($file);
}
add_shortcode( 'show_file', 'show_file_func' );
source →
snippet :  SHORTCODEcopy
[show_file file="http://wpsnipp.com/data.html"]
source →
jqsnipp.com | we just launched jquery snippets website