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 id="pro" class="row">
    <div class="col-12 col-lg-3 float-left">
    <div class="col-12 col-lg-9 float-left">
    <?php while(have_posts()): the_post();?>
    <?php the_title();?>
    <?php endwhile;?>
<?php  get_footer(); ?>
  • Does the rest of this page load? If you add something like <h1>Hello!</h1> before the first line, do you see it when visiting that category page? – phatskat Feb 5 at 5:49
  • 1
    No, but i solved, it was something with the permalink. – Marco Mireles Feb 6 at 22:42

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.