Displaying next and previous posts
-
I currently have the main page displaying the 10 newest posts. How can I add navigation links to show the next 10 posts, previous 10 posts and so on and so forth.
I’ve tried using the <?php posts_nav_link(); ?> template tag but it doesn’t work. It simply calls up this url… http://www.athique.co.uk/index.php/page/2/ which basically just shows my main page.
How do I go about doing this?
Thanks
-
Bump. Anyone?
Need some help on this one please. Thanks.
I am not familiar with your theme but if it has a customized Loop the prev/next won’t work.
Thanks for replying.
From what I know so far, the default Loop in a template is `<?php if (have_posts()) : ?>
<?php while (have_posts()) : the_post(); ?>`This is what’s currently in my index file.
That said, would I be right in saying that it isn’t a customized loop?
That’s the first line only…
The_LoopI know you said it wouldn’t work if The Loop in my theme had been customized, but is there any way around it to use the posts nav link?
I fixed it by removing
query_posts('showposts=10'). The<?php posts_nav_link(); ?>tag works fine now.One last question though. I’ve set the number of posts to be shown as 10 in the options. Will removing the query_posts tag affect/upset anything else in the template?
It shouldn’t.
(yes, using the query_posts – is a modified Loop)So how do you get any navigations (next posts and previous posts) with a modified loop? There should be a waring on the query_posts page stating that it would break the navigation.
By the way I use query_posts on the home page and the page listing articles in a particular category. the navigation appears on the home page but not the page for a category. anyone know why? im using posts_nav_link
Nevermind, it works using query_posts.
The topic ‘Displaying next and previous posts’ is closed to new replies.