Yup, I used this tut to help me along. Then, it’s just a matter of passing in those query vars via form function, like:
<section id="sort">
<form name="search" action="" method="get">
<select name="sort">
<?php
$mouldings_sort_options = array(
'_mouldings_dimensions_height' => 'Height',
'_mouldings_dimensions_width' => 'Width'
);
$sort = !empty($_GET['sort']) ? $_GET['sort'] : '';
foreach ($mouldings_sort_options as $key=>$value) {
echo '<option value="' . $key . '" ' . selected( $sort, $key ) . '>' . $value . '</option>';
}
?>
</select>
<select name="order">
<?php
$mouldings_order_options = array(
'DESC' => 'Descending',
'ASC' => 'Ascending'
);
$order = !empty($_GET['order']) ? $_GET['order'] : '';
foreach ($mouldings_order_options as $key=>$value) {
echo '<option value="' . $key . '" ' . selected( $order, $key ) . '>' . $value . '</option>';
}
?>
</select>
<?php
if (!is_tax('wood_types') || (is_tax('wood_types') && isset($wp_query->query_vars['profile_categories'])) || (is_tax('wood_types') && isset($wp_query->query_vars['combination_categories']))) { ?>
<select name="wood_types">
<?php
$mouldings_wood_types_options = get_terms('wood_types');
$wood_types = !empty($_GET['wood_types']) ? $_GET['wood_types'] : '';
echo '<option value="">All</option>';
foreach ($mouldings_wood_types_options as $key) {
echo '<option value="' . $key->slug . '" ' . selected( $wood_types, $key->slug ) . '>' . $key->name . '</option>';
}
?>
</select>
<?php } ?>
<input type="submit" value="Show/Filter" />
<span class="reset"><a href="<?php echo remove_query_arg(array('sort','order','wood_types')); ?>">Reset</a></span>
</form>
</section>
That’s from a plugin I’m using (you can sort by a custom field that contains the height or width, in ascending or descending order and also filter by a custom taxonomy). I do however need to look back and sanitizing the $_GET value though (as at its current state, that would be a security issue).