include-file wordpress plugin

I may have created one of the simplest possible plugins for WordPress. I also have no doubt that this has probably been created before my multiple other people, but it was easier to create than evaluate the existing options out there. If you just want to download the plugin click here.

This plugin includes the contents of a file from a URL or path into a WordPress page or post using a shortcode. It would look like this in your post:

[include_file url='']

I’ve posted the source code below as it might serve as a good template to someone who wants to create their own plugin.

Plugin Name: include-file
Plugin URI:
Description: Includes the contents of a file at a given url in a post.
Version: 1
Author: Tyler Stafford <>
Author URI:

function tsIncludeFile($atts,$content=null,$code="") {
	$content = file_get_contents($atts['url']); 
	if ($content == true) {
		return $content;
	} else {
		return "An error occured retreiving " . $atts['url'];
	return $atts['url'];