Support » How-To and Troubleshooting » Pagination in archive problem

Pagination in archive problem

  • Hey!

    I use a month archive and in the month archive i have a pagination. I can’t get it working. Here’s some code:

    	$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:


    You can visit the homepage if you want, but I must warn you for strong material: http://www.gumpalalla.se

    First click “<” to go back, and then compare this the month archive, press “September” and try “<” there..

    Thank you!

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Pagination in archive problem’ is closed to new replies.
Skip to toolbar