Пример #1
0
function fflcommerce_sale_products($atts)
{
    global $columns, $per_page, $paged;
    extract(shortcode_atts(array('per_page' => FFLCommerce_Base::get_options()->get('fflcommerce_catalog_per_page'), 'columns' => FFLCommerce_Base::get_options()->get('fflcommerce_catalog_columns'), 'orderby' => FFLCommerce_Base::get_options()->get('fflcommerce_catalog_sort_orderby'), 'order' => FFLCommerce_Base::get_options()->get('fflcommerce_catalog_sort_direction'), 'pagination' => false), $atts));
    $ids = fflcommerce_product::get_product_ids_on_sale();
    if (empty($ids)) {
        $ids = array('0');
    }
    $args = array('post_status' => 'publish', 'post_type' => 'product', 'posts_per_page' => $per_page, 'orderby' => $orderby, 'order' => $order, 'paged' => $paged, 'post__in' => $ids);
    query_posts($args);
    ob_start();
    fflcommerce_get_template_part('loop', 'shop');
    if ($pagination) {
        do_action('fflcommerce_pagination');
    }
    wp_reset_postdata();
    return ob_get_clean();
}