Wordpress:如何过滤Woocommerce中的特色产品

I am using woocommerce and I wanted to know how to filter the products that are set to special/featured in the backend. I will post what I have included in the code below:

<li class="filter_amenities <?php echo 'special' == $cuisine_type?'selected':'' ?>" id="amenities_special" >
    <a href="<?php echo $store_url.'?cuisine_type=special&'.$selected_cat ?>" style="display:block" >
        <img width="15px" src="<?php echo get_template_directory_uri(); ?>/img/star.png"  /> 
        Special Item
    </a>
</li>

The above code displays the list item for featured products, such that when you click the list item, it will display only those items which are featured. I will post the other code below:

var special = ($('#amenities_special').hasClass('selected'))?true:false;

This is the code I have included to fetch the featured items. I am not sure if the above code is correct. Any help will be much appreciated. Thanks

No longer valid, as of WooCommerce version 3+

/**
 * Output featured products.
 *
 * @param array $atts
 * @return string
 */
public static function featured_products( $atts ) {
    $atts = shortcode_atts( array(
        'per_page' => '12',
        'columns'  => '4',
        'orderby'  => 'date',
        'order'    => 'desc',
        'category' => '',  // Slugs
        'operator' => 'IN' // Possible values are 'IN', 'NOT IN', 'AND'.
    ), $atts );

    $meta_query   = WC()->query->get_meta_query();
    $meta_query[] = array(
        'key'   => '_featured',
        'value' => 'yes'
    );

    $query_args = array(
        'post_type'           => 'product',
        'post_status'         => 'publish',
        'ignore_sticky_posts' => 1,
        'posts_per_page'      => $atts['per_page'],
        'orderby'             => $atts['orderby'],
        'order'               => $atts['order'],
        'meta_query'          => $meta_query
    );

    $query_args = self::_maybe_add_category_args( $query_args, $atts['category'], $atts['operator'] );

    return self::product_loop( $query_args, $atts, 'featured_products' );
}

WooCommerce API Docs

Point of interest is the meta_query and query_args. Whether or not a product is featured is stored in postmeta database table. Not sure WooCommerce has code to directly get what you want but you could probably modify the get featured products short code to also check the category etc if you choose.