I have two Custom Post Types Video and Gallery and a Custom Taxonomy Status with the term Featured.
Right now I'm showing these CPT in my index.php
, but I want to style each of them, so I'm using get_template_part
to achieve it.
The problem comes when I want to get templates for an specific term combined with CPT, in this case Featured and Video. It works with regular post with the term Featured, but no with the Custom Post Type.
This is my code:
<?php if (have_posts()) : ?>
<?php while (have_posts()) : the_post(); ?>
<?php
if ( get_post_type() == 'videos' ) : ?>
<?php get_template_part( 'frontales/front', 'video' ); ?>
<?php elseif ( has_term( 'featured', 'status', $post->ID)):?>
<?php get_template_part( 'frontales/front','video-featured' ); ?>
<?php elseif ( get_post_type() == 'gallery' ) : ?>
<?php get_template_part( 'frontales/front', 'gallery' ); ?>
<?php else: ?>
<?php get_template_part( 'frontales/front', 'news' ); ?>
<?php endif; ?>
<?php endwhile; ?>
<?php endif; ?>