Categories: WordPress

WordPress Query Breaks Navigation

This is an alternative to my recent post WordPress Blog display using the more tag
as that method worked on my testing server but it decided to give me 404 errors whilst navigating.


David Molina G / Shutterstock.com

Differences

Instead of changing my home page to display 1 post I decided to change my archive.php to display 5 posts. First and foremost I changed the Blog shown at most settings in admin to 1 as it was this that was causing my problem. I then removed the query to show 1 post from my index.php as shown below.

I opened up my archive.php and placed the following query below get_header to display 5 posts in my page


This has been tested this in archives.php and search.php with and without the WP pagenavi plugin without any problems

Sources

<?php if (is_home()) {
$page = (get_query_var('paged')) ? get_query_var('paged') : 1;
query_posts("showposts=1&paged=$page");
} ?>
Share
Published by
Tracy Ridge
Tags: PHPTutorial

Recent Posts

Hot Web Dev Magazine – 12 Tools From 2024

If you have been following the monthly Hot Web Dev magazine, you will find at… Read More

1 week ago

May 2025 – Hot New Web Dev

Welcome to Hot Web Dev May 2025, featuring the latest technology, web development news and… Read More

3 weeks ago

April 2025 – Hot New Web Dev

Welcome to Hot Web Dev April 2025, featuring the latest technology, web development news and… Read More

2 months ago

March 2025 – Hot New Web Dev

Welcome to Hot Web Dev March 2025, featuring the latest technology and web development news.… Read More

3 months ago

The Era of Personalisation: How AI Is Revolutionising Video Marketing in 2025

The rise of technology is becoming increasingly relevant in our daily lives. Unsurprisingly it's making… Read More

4 months ago

February 2025 – Hot New Web Dev

Welcome to Hot Web Dev February 2025, featuring the latest technology and web development news.… Read More

4 months ago