function et_shop_on_sale_products($args) { if (is_woocommerce_activated()) { $on_sale_query = new WP_Query(array('post_type' => 'product', 'meta_query' => array(array('key' => '_sale_price', 'value' => 0, 'compare' => '>', 'type' => 'numeric')))); if ($on_sale_query->have_posts()) { ?> <section class="et_shop-product-section et_shop-on-sale-products"> <h2 class="section-title"><?php echo wp_kses_post(__('On Sale', 'et_shop')); ?> </h2> <?php echo et_shop_do_shortcode('sale_products', array('per_page' => 4, 'columns' => 4)); ?> </section><?php } } }
?> </aside> <nav class="col-2"> <h2><?php echo esc_html__('Product Categories', 'et_shop'); ?> </h2> <?php the_widget('WC_Widget_Product_Categories', array('count' => 1)); ?> </nav> </div> <aside> <h2><?php echo esc_html__('Popular Products', 'et_shop'); ?> </h2> <?php echo et_shop_do_shortcode('best_selling_products', array('per_page' => 4, 'columns' => 4)); ?> </aside><?php } else { get_search_form(); } ?> </div> </section> </main> </div> <?php get_footer();
function et_shop_promoted_products($per_page = '2', $columns = '2', $recent_fallback = true) { if (is_woocommerce_activated()) { if (wc_get_featured_product_ids()) { echo '<h2>' . esc_html__('Featured Products', 'et_shop') . '</h2>'; echo et_shop_do_shortcode('featured_products', array('per_page' => $per_page, 'columns' => $columns)); } elseif (wc_get_product_ids_on_sale()) { echo '<h2>' . esc_html__('On Sale Now', 'et_shop') . '</h2>'; echo et_shop_do_shortcode('sale_products', array('per_page' => $per_page, 'columns' => $columns)); } elseif ($recent_fallback) { echo '<h2>' . esc_html__('New In Store', 'et_shop') . '</h2>'; echo et_shop_do_shortcode('recent_products', array('per_page' => $per_page, 'columns' => $columns)); } } }