I'm trying to redirect some of my posts from Single.php template to my training-v2 custom template using the code below, but the get_template_part
is not working.
My templates are in the order of
themes/theme/templates/training-v2.php
themes/theme/single.php
Can anyone help with the get_template_part
structure?
<?php
if (have_posts()) : while (have_posts()) : the_post();
$custom_arr = array(6647,6794,6796);
if (in_array(get_the_ID(), $custom_arr)) {
get_template_part( 'themes/theme/templates', 'training-v2' );
}
else {
get_template_part( 'theme/content', 'single' );
}
endwhile; else :
get_template_part( 'parts/content', 'index' );
endif;
?>