Skip to content

Instantly share code, notes, and snippets.

@pvphong90
Created September 20, 2018 08:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pvphong90/9c742b31aab4ad76ee81a4473120aec4 to your computer and use it in GitHub Desktop.
Save pvphong90/9c742b31aab4ad76ee81a4473120aec4 to your computer and use it in GitHub Desktop.
Code lấy ra bộ lọc của Woo
<ul>
<li class="gia_khac">Sắp xếp <i class="icon-angle-down"></i>
<ul class="dropdown woocommerce-ordering">
<?php
$catalog_orderby = apply_filters( 'woocommerce_catalog_orderby', array(
'menu_order' => __( 'Default sorting', 'woocommerce' ),
'popularity' => __( 'Sort by popularity', 'woocommerce' ),
'rating' => __( 'Sort by average rating', 'woocommerce' ),
'date' => __( 'Sort by newness', 'woocommerce' ),
'price' => __( 'Sort by price: low to high', 'woocommerce' ),
'price-desc' => __( 'Sort by price: high to low', 'woocommerce' )
) );
if ( get_option( 'woocommerce_enable_review_rating' ) == 'no' )
unset( $catalog_orderby['rating'] );
foreach ( $catalog_orderby as $id => $name )
echo '<li><a href="' . '?orderby=' . $id . '" >' . esc_attr( $name ) . '</a></li>';
?>
</ul>
</li>
</ul>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment