aldolat
Member
Posted 3 years ago #
I have a page which lists all my "featured posts".
To display these posts I am using this piece of code:
<?php query_posts('cat=1&showposts='.get_option('posts_per_page')); ?>
as written in the codex: http://codex.wordpress.org/Category_Templates#What_categories_do_you_show_to_the_visitors.3F
This line shows me only my posts from category 1 and paginate them accordingly the wp-admin panel option.
But when I go to the page #2 or #3, I view always the page #1.
Why this?
Try:
<?php
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
query_posts('cat=1&showposts='.get_option('posts_per_page').'&paged=' . $paged);
?>
aldolat
Member
Posted 3 years ago #
Thank you for your support! Your code works well. :)
And also this modified version of your code paginate the posts correctly:
<?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; query_posts("cat=1&paged=$paged"); ?>
without specifying the get_option but using the double quote (").