- Open up you functions.php for your theme. (You could create a file that functions.php includes, too, if you want to get fancy.)
- Get your shortcode function in there:
function include_file( $atts ){
ob_start();
$include_name = $atts['name'];
include_once $include_name;
$retVal = ob_get_contents();
ob_end_clean();
return $retVal;
}
add_shortcode( 'include', 'include_file' );
- Use your shortcode by including [include name='./whatever.php'] in your page or post.
No comments:
Post a Comment