WordPress.org

Ready to get started?Download WordPress

Forums

WP-PageNavi
Redirects (2 posts)

  1. kateriine
    Member
    Posted 1 year ago #

    I have a problem using pagenavi:

    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!

    Note: I'm using Roots Theme

    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;
              ?>

    http://wordpress.org/extend/plugins/wp-pagenavi/

  2. kateriine
    Member
    Posted 1 year ago #

    Of course I forgot to say hello, so hello :)

    And of course I just found a solution:
    I's because I'm displaying multiple other posts on a single page, so I added in functions.php:

    add_filter('redirect_canonical','pif_disable_redirect_canonical');
    
    function pif_disable_redirect_canonical($redirect_url) {
        if (is_singular('themes')) $redirect_url = false;
    return $redirect_url;
    }

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.