Skip to content

Instantly share code, notes, and snippets.

@KyleNumann
Created October 9, 2012 16:37
Show Gist options
  • Save KyleNumann/3859931 to your computer and use it in GitHub Desktop.
Save KyleNumann/3859931 to your computer and use it in GitHub Desktop.
Shortcode to include php file
function featured_project_short(){
ob_start();
//include the specified file
include(TEMPLATEPATH.'/inc/featured_project.php');
//assign the file output to $content variable and clean buffer
$content = ob_get_clean();
//return the $content
//return is important for the output to appear at the correct position
//in the content
return $content;
}
//register the Shortcode handler
add_shortcode('featured_project', 'featured_project_short');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment