When you need to display an html file as a returned string (usually inside a shortcode function) use this piece of code inside your function:
1 2 3 4 |
ob_start(); get_template_part( 'myfile.php' ); $output = ob_get_clean(); return $output; |