I am attempting to load a page template into a shortcode so I can easily load the content wherever I want.
I have done some research and many people have said this code has worked for them but for some reason this does not seem to load my template right as I just get a blank page.
I know the shortcode is executing as it does not show as plain text so I'm guessing there is a problem with the way I am loading the template.
Any help is much appreciated .
public function register(){
add_shortcode( 'sponsor_main_page', array($this,'my_form_shortcode') );
$RegistrationFormId = esc_attr( get_option( 'ik_form_id' ) );
}
function my_form_shortcode() {
ob_start();
get_template_part( 'template-sponsors.php' );
return ob_get_clean();
}