Hello,
Site Home - http://redacted/
Listings page - http://redacted/index.php/press/
On the above site I have a limit of 6 posts on archive pages. This works fine until I get more than 6 posts such as here - http://redacted/index.php/press/. The links to move to different archive pages appear and link to http://redacted/index.php/press/page/2/ which seems to be right but once clicked goes to a 404.
If I alter the url to http://redacted/index.php/press/?paged=2 it works fine.
I am simply using the following code to display it:-
<ul class="navlinks">
<li class="left"><?php next_posts_link('« Previous posts') ?></li>
<li class="right"><?php previous_posts_link('Next posts »') ?></li>
</ul>
I am using permalinks with a windows server (hence index.php) so can't doing anything with mod rewrite. I don't want to turn it off either.
Any help is much appreciated.
Dave.
Probably need to set your query_posts to adhere to pagination rules:
Something like:
<?php
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
query_posts($query_string . '&paged=' . $paged);
?>
Thank yuo for your reply.
I have added this to below
<?php if (have_posts()) : ?>
which i assume is the right place but it doesn't seem to effect the URL paths of the previous links at the bottom.
Do I have to do anything else for this to work?
Dave.
If would be before the if (have_posts()) but you may need to post your Template that is displaying your archives at a pastebin and report the link back here.
i have the following code on the archives page - http://pastebin.com/m5e74bbf9
thanks again MichaelH.
Dave.
You code works right for me (i.e. next/previous links return expected posts) when displaying archives.
Using the WordPress Default Theme for testing, I replaced the archive.php with your code. No plugins active, and successfully used both Default and Month and Name Permalinks.
This is wierd.
I don't know if it is something because I am on a windows server but I can't get it to work :(
I also tried it on a local install and it works!
Do you have any idea what I could do? is there a way of changing the URL so it goes to /press/?paged=2 instead of page/2/?
Thanks again MichaelH!
Dave.
I recently ran into this - and after updating the permalinks all worked well so make sure you try that.