WordPress and buddypress programming

Include External File wordpress Shortcode

Tagged: 

Viewing 0 reply threads
  • Author
    Posts
    • #660
      michael mc
      Keymaster
      @michael

      Instructions: Add the following code to the functions.php file of your WordPress theme to include external file shortcode.

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

      Now you can use this shortcode given below with your external file link to include the external file in your WordPress posts and pages.

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

Viewing 0 reply threads
  • You must be logged in to reply to this topic.