Include PHP file in Content using [shortcode]


Here is what I have

I am not having any lucking finding how to simply include a file in the content editor using a shortcode.

For Example if I wanted to include form.php inside my Contact Page how would I make this happen using a shortcode?

Below is was attempting to work with to no avail.

Any help would be appreciated!

// Shortcode implementation
function magic_stuff($atts) {

// turn on output buffering to capture script output


// include file (contents will get saved in output buffer)


// save and return the content that has been output

$content = ob_get_clean();
return $content;
//register the Shortcode handler
add_shortcode('magic', 'magic_stuff');
Eric Downs 4 months 0 Answers 19 views 0

Leave an answer