I've been searching around for a fix to this and while I definitely have a much better understanding of my issue (thanks to similar queries posted by others) I am still not sure of the solution.
I am writing a shortcode as follows:
function cup_bc_shortcode(){
$html = file_get_contents('/html/cup_bc_layout.php', true);
return $html;
}
add_shortcode('budgetcalc', 'cup_bc_shortcode');
The file 'cup_bc_layout.php' contains html and PHP. The PHP code is being rendered as text on output rather than being processed by the browser. Is there anyway to include the PHP file in a manner similar to this?
I appreciate that the shortcode must return the output in order to work but I'd prefer not to have to build this up as a single string from within this function if I can help it.
Also I am quite new to PHP so even the most obvious of solutions may have eluded me.
Your help greatly appreciated.