Hi all, I posted this thread earlier and Remy provided a great solution. Please review my code there and Remy's solution which I have in place.
http://wpquestions.com/question/showChronoLoggedIn/id/9988
However, I'm now noticing that on any page after 1 (i.e. http://www.mysite.com/parentpage/page/2/) the post query does not work and says no post are available.
Again if you read the previous thread you will see I'm calling a popover displaying a list of posts for each term listed on a page... and there are numerous pages of terms.
Please help, thanks!
John Cotton answers:
I've often found that, when using custom post types, the offset parameter is more reliable than the paged param
Try replacing this:
'paged' => get_query_var( 'paged' )
with
$page = max( 1, get_query_var('paged') ) - 1;
$page_size = 8; // or whatever
// and then this is the WP_Query array
....'offset' => $page * $page_size....
streetfire comments:
Ok, I'm a bit confused. I got this...
<?php $wp_query = new WP_Query( array (
'post_type' => 'grid100index',
'tax_query' => array(
array(
'taxonomy' =>'100gridgroups',
'field' => 'slug',
'terms' => $lc->slug
)
),
$page = max( 1, get_query_var('paged') ) - 1;
$page_size = 8; // or whatever
// and then this is the WP_Query array
....'offset' => $page * $page_size....
) ); ?>
Am getting a couple syntax errors and I don't quite understand the WP_Query array part. Please clarify. :S
John Cotton comments:
$page = max( 1, get_query_var('paged') ) - 1;
$page_size = 8; // or whatever
$wp_query = new WP_Query( array (
'post_type' => 'grid100index',
'tax_query' => array(
array(
'taxonomy' =>'100gridgroups',
'field' => 'slug',
'terms' => $lc->slug
)
),
'posts_per_page' => $page_size.
'offset' => $page * $page_size.
) );
streetfire comments:
I'm getting a syntax error on these two lines still
'offset' => $page * $page_size.
) );
John Cotton comments:
It's hard to see code when typing in these boxes.
Those full stops should have been commas. Sorry.
$wp_query = new WP_Query( array (
'post_type' => 'grid100index',
'tax_query' => array(
array(
'taxonomy' =>'100gridgroups',
'field' => 'slug',
'terms' => $lc->slug
)
),
'posts_per_page' => $page_size,
'offset' => $page * $page_size
));
streetfire comments:
Hey no worries. I tried and failed to figure out which character was the culprit. This is working great!!! :D
I did notice something though :( When this new code is in place the numbered pagination on my page template file (where this code is being called to), no longer highlights the active page number any more. See attachment. Is this a easy fix? We're sooooo close!