Forums Forums Search & Filter Pro Pagination Problems

Tagged: 

Viewing 9 posts - 1 through 9 (of 9 total)
  • Anonymous
    #51406

    Hi,

    I’ve seen this problem described many other times by many people, but despite trying everything suggested in each thread I can find on the topic, I am still having the issue. I’m supposed to be launching a site tomorrow evening EST, and this bug would probably hold our launch up, so it’s a big deal that I get this figured out quickly and I would really appreciate some help.

    The issue is that when my pagination links are clicked, they return the user to page 1 of the results instead of the page that was clicked on, and indeed mousing over the pagination links, you can see they do not include any pagination in the URL.

    I’m running Search & Filter Pro 2.1.2.

    Here are the paramaters I’m running for my pagination:

    ‘base’ => str_replace( $big, ‘%#%’, esc_url( get_pagenum_link( $big ) ) ),
    ‘format’ => ‘?sf_paged=%#%’,
    ‘current’ => max( 1, $paged ),
    ‘total’ => $wp_query->max_num_pages,
    ‘prev_next’ => false,
    ‘type’ => ‘array’,
    ‘prev_next’ => TRUE,
    ‘prev_text’ => __(‘Previous’),
    ‘next_text’ => __(‘Next’),

    Here is my URL:
    http://startalk-allstars.com

    Thanks.

    Trevor
    #51417

    I do not see what is around that code (always put code posted here inside back ticks – code tags), but another one that I have seen working looks like this:

    function searchPagination() {
      $big = 999999999; // need an unlikely integer
      global $paged;
      echo paginate_links( array(
       'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ),
       'format' => '?sf_paged=%#%',
       'current' => max( 1, $paged)
      ));
    }
    Anonymous
    #51461

    Hi Trevor,

    I saw this snippet in one of the other threads and I’d tried using pieces of it to no avail. This morning (my time) I went ahead and tried to use the entire function in your example as-is to see if that might help, but I still have the same problem–all pagination links point back to the first page. What else can I do to get pagination working? Thanks.

    -Brian.

    Trevor
    #51463

    Hi Brian

    Is this a commercial theme or one that you wrote?

    Anonymous
    #51472

    It’s one I wrote myself. The pagination works fine for pages that are not using Search & Filter, though I had to write two pagination scripts, one with format set to ‘?paged=%#%’ and the other with ‘?sf_paged=%#%’

    Trevor
    #51478

    Can you show me the full script for the pagination? Please use the code tags (one before and one after, it is in the editor toolbar).

    Anonymous
    #51488

    I rewrote it to use the pagination you pasted above. Here’s what it looked like before

    function sf_pagination() { // As above, but with Search & Filter pagination
        global $wp_query;
        $big = 999999999;
        $pages = paginate_links( array(
                'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ),
                'format' => '?paged=%#%',
                'current' => max( 1, $sf_paged ),
                'total' => $wp_query->max_num_pages,
                'prev_next' => false,
                'type'  => 'array',
                'prev_next'   => TRUE,
    			'prev_text' => __('Previous'),
    			'next_text' => __('Next'),
            ) );
            if( is_array( $pages ) ) {
                $paged = ( get_query_var('paged') == 0 ) ? 1 : get_query_var('paged');
                echo '<ul class="pagination">';
                foreach ( $pages as $page ) {
                        echo "<li>$page</li>";
                }
               echo '</ul>';
            }
    }
    Anonymous
    #51489

    Sorry, scratch that, I had to re-write it and changed the wrong lines. This is correct.

    function sf_pagination() { // As above, but with Search & Filter pagination
        global $wp_query;
        $big = 999999999;
        $pages = paginate_links( array(
                'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ),
                'format' => '?sf_paged=%#%',
                'current' => max( 1, $paged ),
                'total' => $wp_query->max_num_pages,
                'prev_next' => false,
                'type'  => 'array',
                'prev_next'   => TRUE,
    			'prev_text' => __('Previous'),
    			'next_text' => __('Next'),
            ) );
            if( is_array( $pages ) ) {
                $paged = ( get_query_var('paged') == 0 ) ? 1 : get_query_var('paged');
                echo '<ul class="pagination">';
                foreach ( $pages as $page ) {
                        echo "<li>$page</li>";
                }
               echo '</ul>';
            }
    }
    Trevor
    #51593
    This reply has been marked as private.
Viewing 9 posts - 1 through 9 (of 9 total)