Merge pull request #2220 from GeertDD/sorting

Simplified code for keeping query string vars intact
This commit is contained in:
Mike Jolley 2013-01-12 07:20:53 -08:00
commit b0d22c079b
1 changed files with 2 additions and 11 deletions

View File

@ -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 ) . '" />';
}