woocommerce/templates/loop/sorting.php

33 lines
954 B
PHP
Raw Normal View History

2011-12-11 01:10:24 +00:00
<?php
/**
* Sorting
2012-08-14 18:05:45 +00:00
*
* @author WooThemes
* @package WooCommerce/Templates
2012-09-07 17:26:13 +00:00
* @version 1.7
2011-12-11 01:10:24 +00:00
*/
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
2012-09-07 17:26:13 +00:00
global $woocommerce;
if ( ! woocommerce_products_will_display() )
return;
2011-12-11 01:10:24 +00:00
?>
<form class="woocommerce_ordering" method="post">
2012-02-10 22:15:29 +00:00
<select name="sort" class="orderby">
2011-12-11 01:10:24 +00:00
<?php
$catalog_orderby = apply_filters( 'woocommerce_catalog_orderby', array(
'menu_order' => __( 'Default sorting', 'woocommerce' ),
'title' => __( 'Sort alphabetically', 'woocommerce' ),
'date' => __( 'Sort by most recent', 'woocommerce' ),
'price' => __( 'Sort by price - low to high', 'woocommerce' ),
'high_price' => __( 'Sort by price - high to low', 'woocommerce' )
) );
2011-12-11 01:10:24 +00:00
2012-08-14 18:05:45 +00:00
foreach ( $catalog_orderby as $id => $name )
2012-09-07 17:26:13 +00:00
echo '<option value="' . $id . '" ' . selected( $woocommerce->session->orderby, $id, false ) . '>' . $name . '</option>';
2011-12-11 01:10:24 +00:00
?>
</select>
</form>