HomeWordpress → WP Query Breaks Navigation

WP Query Breaks Navigation

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

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.

1
2
3
4
<?php if (is_home()) {
$page = (get_query_var('paged')) ? get_query_var('paged') : 1;
query_posts("showposts=1&paged=$page");
} ?>

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

1
2
<?php get_header();?>
<?php query_posts($query_string.'&showposts=5'); ?>

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

Sources

Related Posts

Share

Enjoyed this article? Then recommend it to your friends

               

Leave a Reply

Your email address will not be published. Required fields are marked *

*

* Copy this password:

* Type or paste password here:

4,942 Spam Comments Blocked so far by Spam Free Wordpress

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>