Quantcast
Channel: WPRecipes
Viewing all articles
Browse latest Browse all 121

Shortcode to display external files on your posts

$
0
0

Open your functions.php file and paste the following function in it:

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' );

Once done, you can use the shortcode. It's pretty simple:

[show_file file="http://www.test.com/test.html"]

Thanks to Vladimir Prelovac for the handy tip!


Viewing all articles
Browse latest Browse all 121

Trending Articles