Merge pull request #2220 from GeertDD/sorting
Simplified code for keeping query string vars intact
This commit is contained in:
commit
b0d22c079b
|
@ -35,17 +35,8 @@ if ( ! woocommerce_products_will_display() || 1 == $wp_query->found_posts )
|
|||
</select>
|
||||
<?php
|
||||
// Keep query string vars intact
|
||||
$parts = explode( '?', $_SERVER['REQUEST_URI'] );
|
||||
|
||||
$query = isset( $parts[1] ) ? $parts[1] : '';
|
||||
|
||||
if ( $frag = strstr( $query, '#' ) )
|
||||
$query = substr( $query, 0, -strlen( $frag ) );
|
||||
|
||||
wp_parse_str( $query, $qs );
|
||||
|
||||
foreach ( $qs as $key => $val ) {
|
||||
if ( $key == 'orderby' )
|
||||
foreach ( $_GET as $key => $val ) {
|
||||
if ( 'orderby' == $key )
|
||||
continue;
|
||||
echo '<input type="hidden" name="' . esc_attr( $key ) . '" value="' . esc_attr( $val ) . '" />';
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue