0

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(); ?>
  • 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
1

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 acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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