I have a post type shopping
and in my single.php
I am trying to get a certain template for this post type. So I did:
\\ in the single.php
get_template_part( 'template-parts/content', get_post_format() );
and in template-parts
directory, I created a file named content-shopping.php
. But no matter what, the single template used is the default content.php
.
However, if I do something like this:
if ( 'shopping' === get_post_type() ) {
get_template_part( 'template-parts/content-shopping' );
}else{
get_template_part( 'template-parts/content', get_post_format() );
}
then the template is used for that post type. I am not sure why the first method is not working. Any idea?