Icethrill
Member
Posted 2 years ago #
Hey!
So I am using a page template to show the posts of 5 different categories. Its working really good, except that somehow the Previous and Next posts pagination aint working. I am calling query_posts in this page template than testing for if its "that" page. If so take the latest 10 posts from the category and show them.
A code snippet from my page template:
<?php if(is_page('XXX')){ ?>
<?php query_posts('category_name=XXX'); ?>
<?php thematic_above_indexloop() ?>
<?php thematic_indexloop() ?>
<?php thematic_below_indexloop() ?>
<?php wp_reset_query(); ?>
<?php } ?>
But there is no pagination. I am using the thematic theme. Is this possible to have pagination on a page?
Hi
You have to add a few lines of code to each query posts section,
like this
<?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
query_posts("category_name=XXX&paged=$paged"); ?>
Make sure you have double quotes on the query posts line
Icethrill
Member
Posted 2 years ago #
It does not work that well, no pagination at all at the moment.
<?php if(is_page('98')){ ?>
<?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
query_posts("cat=4,5,6,18,21&paged=$paged"); ?>
<?php thematic_above_indexloop() ?>
<?php thematic_indexloop() ?>
<?php thematic_below_indexloop() ?>
<?php wp_reset_query(); ?>
<?php } ?>
Here is the real code. Any ideas what is wrong with it?
Edit: Ok thanks! Will check those articles up!
Icethrill
Member
Posted 2 years ago #
Thanks found a workaround now! Its working great! :)
@stvwlf
thank you so much for that piece of code. that fixed my issue with paginating custom category pages. before the next link would simply take me to the same posts that were listed at first.
again, thanks A LOT!
E Anderson
Member
Posted 2 years ago #
This is brilliant, thank you so much.
@luthan, thanks for posting this code at the other discussion: http://wordpress.org/support/topic/205350
No one else was nearly as helpful.