Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Bug fix: pagination links don't work when you have a get parameter added... #57

Open
wants to merge 1 commit into from

3 participants

Enej Bajgoric Justin Tadlock Gary Jones
Enej Bajgoric

Fix for issue #56 Loop Pagination Extension Bug

Justin Tadlock

I'm going to dig into this a bit more. It's something we've known about but haven't had a good solution for handling. Can you post the patch against version 1.6 or 2.0 branch and not the stable, master branch?

Enej Bajgoric
Gary Jones

Just tested the diff against 2.0.0 and it appears to fix the problem for archive navigation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jan 27, 2014
  1. Enej Bajgoric
This page is out of date. Refresh to see the latest.
Showing with 15 additions and 3 deletions.
  1. +15 −3 extensions/loop-pagination.php
18 extensions/loop-pagination.php
View
@@ -69,8 +69,21 @@ function loop_pagination( $args = array() ) {
);
/* Add the $base argument to the array if the user is using permalinks. */
- if ( $wp_rewrite->using_permalinks() && !is_search() )
- $defaults['base'] = user_trailingslashit( trailingslashit( get_pagenum_link() ) . "{$pagination_base}/%#%" );
+ if ( $wp_rewrite->using_permalinks() && !is_search() ) {
+ if( empty( $_GET ) ){
+ $defaults['base'] = user_trailingslashit( trailingslashit( get_pagenum_link() ) . "{$pagination_base}/%#%" );
+ } else {
+ $clean_url = get_pagenum_link();
+ $parsed_url = parse_url($clean_url);
+ $query = '';
+
+ if( !empty( $parsed_url['query'] ) ) {
+ $query='?'.$parsed_url['query'];
+ $clean_url = preg_replace( '/\?'.$query.'/', '', $clean_url );
+ }
+ $defaults['base'] = user_trailingslashit( trailingslashit( $clean_url ) . "{$pagination_base}/%#%" ) .$query;
+ }
+ }
/* Allow developers to overwrite the arguments with a filter. */
$args = apply_filters( 'loop_pagination_args', $args );
@@ -109,5 +122,4 @@ function loop_pagination( $args = array() ) {
else
return $page_links;
}
-
?>
Something went wrong with that request. Please try again.