skip to Main Content

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?

2

Answers


  1. 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.

    Login or Signup to reply.
  2. 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(); ?>
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search