'; echo '
'; echo '
'; if (is_shop()) { /** * Note to code reviewers: This line doesn't need to be escaped. * Function blocksy_output_hero_section() used here escapes the value properly. */ echo blocksy_output_hero_section('type-1'); } echo '
'; } ); add_action( 'woocommerce_before_shop_loop', function () { echo '
'; }, 50 ); add_action( 'woocommerce_after_main_content', function () { echo '
'; get_sidebar(); echo '
'; echo ''; } ); $woocommerce_shortcodes = [ 'product', 'products', 'product_category', 'recent_products', 'sale_products', 'best_selling_products', 'top_rated_products', 'featured_products', 'featured_products', ]; foreach ($woocommerce_shortcodes as $woo_single_shortcode) { add_filter( 'shortcode_atts_' . $woo_single_shortcode, function ($out, $pairs, $atts, $shortcode) { if (isset($out['class'])) { $out['class'] = trim(trim($out['class']) . ' __ct_products_shortcode__'); } else { $out['class'] = '__ct_products_shortcode__'; } if (isset($atts['disable_button'])) { $out['disable_button'] = $atts['disable_button']; } return $out; }, 10, 4 ); add_action( 'woocommerce_shortcode_before_' . $woo_single_shortcode . '_loop', function ($attributes) { if (! isset($attributes['disable_button'])) { return; } // TODO: handle non-default layout cases remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart', 10 ); } ); add_action( 'woocommerce_shortcode_after_' . $woo_single_shortcode . '_loop', function ($attributes) { if (! isset($attributes['disable_button'])) { return; } // TODO: handle non-default layout cases add_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart', 10 ); } ); } add_filter( 'do_shortcode_tag', function ($output, $tag, $attr, $m) use ($woocommerce_shortcodes) { if ($tag === 'woocommerce_my_account') { return str_replace( 'class="woocommerce"', 'class="woocommerce ' . (is_user_logged_in() ? 'ct-woo-account' : 'ct-woo-unauthorized') . '"', $output ); } if (!in_array($tag, $woocommerce_shortcodes)) { return $output; } return str_replace( ' __ct_products_shortcode__"', '" ' . blocksy_products_layout_attr(), $output ); }, 9999, 4 ); add_action( 'woocommerce_before_shop_loop', function () { echo '
'; }, 100 ); add_action( 'woocommerce_after_shop_loop', function () { echo '
'; }, 5 ); if (! function_exists('blocksy_get_products_listing_layout')) { function blocksy_get_products_listing_layout() { return get_theme_mod('shop_cards_type', 'type-1'); } } if (! function_exists('blocksy_products_layout_attr')) { function blocksy_products_layout_attr() { $shop_structure = blocksy_get_products_listing_layout(); return 'data-products="' . $shop_structure . '"'; } }