Forums Forums Search & Filter Pro Pagination doesn’t” work properly

Tagged: 

Viewing 10 posts - 1 through 10 (of 15 total)
  • Anonymous
    #241098

    Pagination doesn’t” work properly

    Hello. I am using search and Filter pro and having problem with pagination.
    It seems to work fine but when I go back to page 1, only page 1 doesn’t have the link(doesn’t have href).
    And it happens only PC view, if I check with SP, it works just fine.

    Here is My code.
    (*I use original code for pagination, but if tried to use WP-PageNavi(same as your template of results.php) Page 1 doesn’t work either.)

    [results.php]

    <?php
    if ($query->have_posts()) : ?>
    <?php
        while ($query->have_posts()) {
            $query->the_post(); ?>
    <a href="<?php the_permalink(); ?>" class="sresult">
      <?php
          if (has_post_thumbnail()) {
              echo '<p class="sresult-thumb">';
              the_post_thumbnail();
              echo '</p>';
          } ?>
      <h2 class="sresult-ttl"><?php the_title(); ?></h2>
      <p class="sresult-name"><?php the_field('interview_name'); ?>
      </p>
      <?php
          $fields = get_field_objects($post_id);
            $dir_array = $fields["interview_occupation"]["choices"];
            $check = get_field('interview_occupation');
            $value = $check[0]; ?>
      <p class="sresult-job"><?php echo $dir_array[$value]; ?></p>
    
    </a><!-- /.sresult -->
    
    <?php } ?>
    
    <div class="spagination">
      <?php
        if ( function_exists( 'pagination' ) ) :
            pagination( $query->max_num_pages, get_query_var( 'paged' ) ); 
        endif;
      ?>
    </div><!-- /.spagination -->
    
    <?php else : ?>
      <div class="snoresult">
        <p>No results</p>
      </div><!-- /.snoresult -->
    <?php endif; ?>
    
    </div><!-- /. search-filter-results -->

    [functions.php]

    function pagination( $pages, $paged, $range = 2, $show_only = false ) {
    
      $pages = ( int ) $pages;    
      $paged = $paged ?: 1;       
    
      //表示テキスト
      $text_first   = "« FIRST";
      $text_before  = "PREV";
      $text_next    = "NEXT";
      $text_last    = "LAST »";
    
      if ( $show_only && $pages === 1 ) {
        
        echo '<div class="pagination"><span class="current pager">1</span></div>';
        return;
      }
    
      if ( $pages === 1 ) return;    
    
      if ( 1 !== $pages ) {
        
        echo '<div class="pagination"><span class="page_num">Page ', $paged ,' of ', $pages ,'</span>';
        if ( $paged > $range + 1 ) {
          // FIRST
          echo '<a href="', get_pagenum_link(1) ,'" class="first js_redirect_to_pagenum_link">', $text_first ,'</a>';
        }
        if ( $paged > 1 ) {
          // PREV
          echo '<a href="', get_pagenum_link( $paged - 1 ) ,'" class="prev js_redirect_to_pagenum_link">', $text_before ,'</a>';
        }
        for ( $i = 1; $i <= $pages; $i++ ) {
          if ( $i <= $paged + $range && $i >= $paged - $range ) {
            // $paged +- $range 以内であればページ番号を出力
            if ( $paged === $i ) {
                echo '<span class="current pager">', $i ,'</span>';
            } else {
              echo '<a href="', get_pagenum_link( $i ) ,'" class="pager js_redirect_to_pagenum_link">', $i ,'</a>';
              }
            }
        }
        if ( $paged < $pages ) {
          // NEXT
          echo '<a href="', get_pagenum_link( $paged + 1 ) ,'" class="next js_redirect_to_pagenum_link">', $text_next ,'</a>';
        }
        if ( $paged + $range < $pages ) {
          // LAST
          echo '<a href="', get_pagenum_link( $pages ) ,'" class="last js_redirect_to_pagenum_link">', $text_last ,'</a>';
        }
        echo '</div>';
      }
    }

    The website is my client site so I cannot give you the link. But if you provide me a contact address that I can send you directly or hide this topic somehow, I can give you the link of testsite.

    Regards,

    Trevor
    #241106
    This reply has been marked as private.
    Anonymous
    #241452

    Hi Trevor. Did you get my msg?

    I tried twice to reply as “private reply” but msg doesn’t show anywhere…

    Anonymous
    #241451
    This reply has been marked as private.
    Trevor
    #241461
    This reply has been marked as private.
    Trevor
    #241522
    This reply has been marked as private.
    Anonymous
    #241661
    This reply has been marked as private.
    Anonymous
    #241663
    This reply has been marked as private.
    Trevor
    #241830
    This reply has been marked as private.
    Anonymous
    #242013
    This reply has been marked as private.
Viewing 10 posts - 1 through 10 (of 15 total)