$8
Pagination not working (WP-Page Navi)
I am having trouble with the pagination on my wordpress theme. Its a custom theme built from the ground up.
I am using the wp-page-navi plugin to provide users with a nice easy to use page navigation. The navigation is showing up fine, but when you click on Page 2 it just stays on Page 1. It was working at some point so I obviously did something to mess it up.
Here is the code for my "loop" that pulls in and lists the posts:
<?php $exclude = get_option('ss_blogexclude'); ?>
<?php query_posts('cat=' . $exclude); ?>
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
Here is the code that checks for the page-navi function and displays it if it exists. This bit of code is outside of the loop above.
<?php if(function_exists('wp_pagenavi')) { wp_pagenavi(); } ?>
Any help is greatly appreciated.
WP Answers | 04/22/10 at 11:56pm
| Edit
(1) Possible Answers Submitted...
-

Last edited:
04/23/10
12:14amLew Ayotte says:Try changing your query post to this:
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
$exclude = get_option('ss_blogexclude');
query_posts('cat=' . $exclude .'&paged=' . $paged);
Lew
Previous versions of this answer: 04/23/10 at 12:06am | 04/23/10 at 12:08am | 04/23/10 at 12:09am
- 04/23/10 12:13am
WP Answers says:Thanks for the quick reply. When I input that code none of the content on the page loads. Am I inserting it correctly? I replaced my whole loop with this. Is there any part of the old loop I need to keep?
<?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; ?>
<?php $exclude = get_option('ss_blogexclude'); ?>
<?php query_posts('cat=' . $exclude .'&paged=' . $paged); ?>
- 04/23/10 12:14am
WP Answers says:I just answered my own question. I needed that last line of code from my loop. Works perfectly! Thank you so much!!
Final working code:
<?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; ?>
<?php $exclude = get_option('ss_blogexclude'); ?>
<?php query_posts('cat=' . $exclude .'&paged=' . $paged); ?>
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
- 04/23/10 12:13am
This question has expired.
Current status of this question: Completed





