• Resolved wrxbuzz

    (@wrxbuzz)


    Hi Guys,

    I’m using a custom pagination system and when trying to pass variables through my URL the my HREF’s get scrambled. Any idea how to fix that?

    When clicking on the “Next” pagination page I get:
    /perfumes/?cat=women-testerspage/2

    instead of this:
    /perfumes/page/2/?cat=women-testers

    I’m guessing its something to do with reformatting this code, but I’m not sure how:

    $pagination_args = array(
        'base'            => get_pagenum_link(1) . '%_%',
        'format'          => 'page/%#%',
        'total'           => $numpages,
        'current'         => $paged,
        'show_all'        => False,
        'end_size'        => 1,
        'mid_size'        => $pagerange,
        'prev_next'       => True,
        'prev_text'       => __('«'),
        'next_text'       => __('»'),
        'type'            => 'plain',
        'add_args'        => false,
        'add_fragment'    => ''
      );
    
      $paginate_links = paginate_links($pagination_args);

    Here’s my pagination code from functions.php: http://pastebin.com/9ueAg6sn

    Thanks for the help!

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter wrxbuzz

    (@wrxbuzz)

    Self-Solved!

    I replaced:

    'base'            => get_pagenum_link(1) . '%_%',
        'format'          => 'page/%#%',
        'total'           => $numpages,
        'current'         => $paged,

    With:

    'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ),
        'format' => '?paged=%#%',
        'total' => $numpages,
        'current' => $paged,

    hi!
    What’s your $big?
    I got the same problem and I don’t get how your code is working….

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Pagination Problem’ is closed to new replies.