/** * Display On Sale Products * Hooked into the `homepage` action in the homepage template * @since 1.0.0 * @return void */ function eighteen_tags_on_sale_products($args) { if (is_woocommerce_activated()) { $args = apply_filters('eighteen_tags_on_sale_products_args', array('limit' => 4, 'columns' => 4, 'title' => __('On Sale', 'eighteen-tags'))); echo '<section class="eighteen-tags-product-section eighteen-tags-on-sale-products">'; do_action('eighteen_tags_homepage_before_on_sale_products'); echo '<h2 class="section-title">' . wp_kses_post($args['title']) . '</h2>'; echo eighteen_tags_do_shortcode('sale_products', array('per_page' => intval($args['limit']), 'columns' => intval($args['columns']))); do_action('eighteen_tags_homepage_after_on_sale_products'); echo '</section>'; } }
function eighteen_tags_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', 'eighteen-tags') . '</h2>'; echo eighteen_tags_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', 'eighteen-tags') . '</h2>'; echo eighteen_tags_do_shortcode('sale_products', array('per_page' => $per_page, 'columns' => $columns)); } elseif ($recent_fallback) { echo '<h2>' . esc_html__('New In Store', 'eighteen-tags') . '</h2>'; echo eighteen_tags_do_shortcode('recent_products', array('per_page' => $per_page, 'columns' => $columns)); } } }
if (is_woocommerce_activated()) { the_widget('WC_Widget_Product_Search'); } else { get_search_form(); } ?> <?php if (is_woocommerce_activated()) { echo '<div class="fourohfour-columns-2">'; echo '<div class="col-1">'; eighteen_tags_promoted_products(); echo '</div>'; echo '<div class="col-2">'; echo '<h2>' . esc_html__('Product Categories', 'eighteen-tags') . '</h2>'; the_widget('WC_Widget_Product_Categories', array('count' => 1)); echo '</div>'; echo '</div>'; echo '<h2>' . esc_html__('Popular Products', 'eighteen-tags') . '</h2>'; echo eighteen_tags_do_shortcode('best_selling_products', array('per_page' => 4, 'columns' => 4)); } ?> </div><!-- .page-content --> </section><!-- .error-404 --> </main><!-- #main --> </div><!-- #primary --> <?php get_footer();