Home > Mobile >  how to display categories without topics
how to display categories without topics

Time:10-15

How can I show categories with no posts on my wordpress site? When I enter the urls of the category, it gives a page not found error. I want the blank page to appear even if there is no post linked to the category, how can I do it?

CodePudding user response:

You can do this by editing your theme's template files. Look for the template file that contains the code for displaying your site's categories. In that file, find the code that checks to see if there are any posts in the category. If there are no posts, then that code should display a blank page.

CodePudding user response:

Create a category.php file in your theme root folder.

<?php get_header(); ?>
    <?php if( have_posts() ): ?>
    <?php while ( have_posts() ) : the_post(); ?>
        
        Category info

    <?php endwhile; ?>

    <?php else: ?>
        There is No categories to show
    <?php endif; ?>
<?php get_footer(); ?>
  • Related