url rewrites, pagination and posts2posts
-
Hello
I have a problem using posts2posts:
I link related articles on a page, ordered by a custom date field, and I want them paged. Problem is that the pagination is always showing the same results (I’m using pagenavi and already tested the multiple solutions they give).
When I disable the url rewriting… it works.
Does anyone see a solution about this?
Thanks!
url: http://adc.spade.be/themes/formation-formateurs-et-enseignants/
<?php if ( get_query_var('paged') ) { $paged = get_query_var('paged'); } elseif ( get_query_var('page') ) { $paged = get_query_var('page'); } else { $paged = 1; } // Find connected pages $connected = new WP_Query( array( 'connected_type' => 'themes_to_events', 'connected_items' => get_queried_object(), 'nopaging' => false, 'paged' => $paged, 'meta_query' => array( array( 'key' => 'wpcf-event-date', ) ), 'meta_key' => 'wpcf-event-date', 'orderby' => 'meta_value', 'order' => 'ASC' ) ); // Display connected pages if ( $connected->have_posts() ) : ?> <section class="events-list-by-theme clearfix"> <h1>Evénements</h1> <?php while ( $connected->have_posts() ) : $connected->the_post(); ?> <article > <i class="icon-user icon-3x pull-left"></i> <div class="pull-left"> <div class="event-date"><?php echo do_shortcode('[types field="event-date" format="l j F Y"][/types]');?></div> <h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></h2></a> </div> </article> <?php endwhile; ?> </section> <?php wp_pagenavi(array( 'query' => $connected)); wp_reset_postdata(); endif; ?>
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘url rewrites, pagination and posts2posts’ is closed to new replies.