Pagination in month archive
-
Hello!
I use a month archive and in the month archive i have a pagination. I want to show 10 posts per page (default?), and if there are more than 10 posts in that month i want to show earlier posts. can’t get it working. This is my “normal” paginatin, the one i use in index.php:
<?php $totalposts = $wp_query->found_posts; $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; $per_page = get_query_var('posts_per_page'); $last_page = ceil($totalposts / $per_page); if($last_page > $paged) { next_posts_link('< '); } else { echo '< ';} echo "<strong>" .$paged. "</strong>"; if($paged > 1) { previous_posts_link(' >'); } else { echo ' >';} ?>
This produces “< 1 >”, the arrows are links.
This works fine if you’re not in the month archive.
I use the exact same code in index.php and archive.php, exept for that I use the following code in archive.php:
<?php $month=get_query_var('monthnum'); $posts=get_posts('monthnum='.$month); ?>
Thank you!
Viewing 7 replies - 1 through 7 (of 7 total)
Viewing 7 replies - 1 through 7 (of 7 total)
- The topic ‘Pagination in month archive’ is closed to new replies.