barocky82
Member
Posted 1 year ago #
Hi,
I am looking to present a page that will show two things:
1. Show the most recent 5 posts of a particular category ("blog_post").
2. Have a link at the bottom of the page that shows navigation to the next 5 posts of that category.
I am able to get the first part completed, but am having trouble finding what function(s) to use to get the navigation to show up and do what I want.
Here is my code:
[Code moderated as per the Forum Rules. Please use the pastebin]
Any help is greatly appreciated!! Thanks!!
barocky82
Member
Posted 1 year ago #
Thanks for the reply ESMI.
Here is my template code of that page now: Pastebin
I see the "Next Page >>" link at the bottom of my page now, but when I click it, it just shows the same 5 posts. In all I have 7 posts, so it should show the oldest 2 posts when I click the link, right? Any ideas?
Thanks!
Try replacing <?php query_posts('category_name=blog_post&posts_per_page=5'); ?> with:
<?php
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
query_posts('category_name=blog_post&posts_per_page=5&paged=' . $paged); ?>
barocky82
Member
Posted 1 year ago #
That works perfectly!! Thank you!!