No posts going to 404 page?
-
When clicking on a category that has no posts, it will direct you to the 404 page. Why is that? Shouldn’t it display what’s after the else section on the archive page?
Here is my code:
<?php get_header(); ?> <div id="content"> <div id="content-left"> <?php is_tag(); ?> <?php if (have_posts()) : ?> <?php $post = $posts[0]; // Hack. Set $post so that the_date() works. ?> <?php /* If this is a category archive */ if (is_category()) { ?> <h2><?php single_cat_title(); ?></h2><div class="category-description"><?php echo category_description(); ?></div> <?php } ?> <?php while (have_posts()) : the_post(); ?> Post stuff goes here... <?php endwhile; ?> <div id="page-nav"> <?php if(function_exists('wp_pagenavi')) { wp_pagenavi(); } ?> </div> <?php else : ?> <h2>Not Found</h2> <?php include (TEMPLATEPATH . '/searchform.php'); ?> <?php endif; ?> </div> <!-- END CONTENT LEFT //--> <?php get_sidebar(); ?> <?php get_footer(); ?>
Based on the above, if there are no posts, shouldn’t it display:
<h2>Not Found</h2> <?php include (TEMPLATEPATH . '/searchform.php'); ?>
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘No posts going to 404 page?’ is closed to new replies.