404 Page modifications
-
Hi,
In 404 page I would like to display a message and then display all the posts in wordpress. The below code is not working and obviously it seems that 404 is meddling with the default global query which results in zero records.
if ( have_posts() ) : ?> <div> <?php while ( have_posts() ) : the_post(); ?> <div> <?php get_template_part( 'content', get_post_format() );?> </div> <?php else : ?> <div> <h3>No posts to show </div> <?php endif; ?>
This code always go to the else block in the 404 page. This is the same code I use on the main page to display all the posts. I tried to place wp_reset_query(); to reset the query to global default but no luck in fetching all the posts.
What am I missing here?
Thanks
Guna
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘404 Page modifications’ is closed to new replies.