From 6a8af48e0a7d14ffe4e7baea75e8aa2f2d9779fd Mon Sep 17 00:00:00 2001 From: Will Bradley Date: Wed, 26 Feb 2014 13:06:17 -0700 Subject: [PATCH] Pagination working in the search --- classes/xml-search.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) mode change 100644 => 100755 classes/xml-search.php diff --git a/classes/xml-search.php b/classes/xml-search.php old mode 100644 new mode 100755 index b10d0d1..67a4bce --- a/classes/xml-search.php +++ b/classes/xml-search.php @@ -51,10 +51,12 @@ if ( !class_exists( 'SM_XML_Search' ) ){ $limit = apply_filters( 'sm-xml-search-limit', $limit ); - if ( $input['page'] && $input['page'] < 250 ) - $offset = 'OFFSET ' . ( absint($input['page']) - 1) * $limit; - else + if ( $input['page'] && $input['page'] < 250 ) { + $offset = 'OFFSET ' . ( absint($input['page']) - 1) * absint( $input['limit'] ); + } + else { $offset = ''; + } // Locations within specific distance or just get them all? $distance_select = $wpdb->prepare( "( 3959 * ACOS( COS( RADIANS(%s) ) * COS( RADIANS( lat_tbl.meta_value ) ) * COS( RADIANS( lng_tbl.meta_value ) - RADIANS(%s) ) + SIN( RADIANS(%s) ) * SIN( RADIANS( lat_tbl.meta_value ) ) ) ) AS distance", $input['lat'], $input['lng'], $input['lat'] ) . ', ';