I found a way, although now I have to be careful with upgrades – I added a method called aFhfc_execute_php. I call it before returning the final html.
/*
F R O N T E N D O U T P U T
===============================
Outputs the head and footer code for individual posts
*/
function aFhfc_execute_php($html){
if(strpos($html,"<"."?php")!==false){ ob_start(); eval("?".">".$html);
$html=ob_get_contents();
ob_end_clean();
}
return $html;
}
function aFhfc_head_output( $post ) {
$aFhfc_head_code = get_post_meta( get_the_ID(), 'aFhfc_head_code', true );
echo aFhfc_execute_php($aFhfc_head_code)."\n";
}
add_action('wp_head', 'aFhfc_head_output');
function aFhfc_footer_output( $post ) {
$aFhfc_footer_code = get_post_meta( get_the_ID(), 'aFhfc_footer_code', true );
echo aFhfc_execute_php($aFhfc_footer_code)."\n";
}
add_action('wp_footer', 'aFhfc_footer_output');