I have a CPT and each post has categories and sub categories. When I enter the Category.php page this does not print any post.
<?php get_header(); ?>
<div class="row">
<div class="col-12 float-left mt-3">
<h1>Category <span><?php single_cat_title(); ?></span></h1>
</div>
</div>
<div id="pro" class="row">
<div class="col-12 col-lg-3 float-left">
<?php
get_sidebar();
?>
</div>
<div class="col-12 col-lg-9 float-left">
<?php while(have_posts()): the_post();?>
<?php the_title();?>
<?php endwhile;?>
</div>
</div>
</div>
<?php get_footer(); ?>
I have a CPT and each post has categories and sub categories. When I enter the Category.php page this does not print any post.
<?php get_header(); ?>
<div class="row">
<div class="col-12 float-left mt-3">
<h1>Category <span><?php single_cat_title(); ?></span></h1>
</div>
</div>
<div id="pro" class="row">
<div class="col-12 col-lg-3 float-left">
<?php
get_sidebar();
?>
</div>
<div class="col-12 col-lg-9 float-left">
<?php while(have_posts()): the_post();?>
<?php the_title();?>
<?php endwhile;?>
</div>
</div>
</div>
<?php get_footer(); ?>
First of all the template is category.php
(without a capital letter.
Second of all, you say you have a
Custom Post Type with categories
most likely you mean you have a
Custom Post Type with a Custom Taxonomy
In order to design a custom page template to show cpt from a custom taxonomy, you need to use name your template taxonomy.php
. Please see the template hierarchy for more details.
<h1>Hello!</h1>
before the first line, do you see it when visiting that category page? – phatskat Commented Feb 5, 2019 at 5:49