get( 'Version' ) ); // Enqueue theme stylesheet. wp_enqueue_style( 'ellusive-style' ); } endif; add_action( 'wp_enqueue_scripts', 'ellusive_styles' ); if ( ! function_exists( 'ellusive_remove_upsells' ) ) : /** * Removes WooCommerce's classic upsells from the single product page. * * In block themes WooCommerce still prints the classic "You may also like…" * upsells markup after the last block of the Single Product template. It * doesn't match the theme's design, so it is removed, as in Purple. * * @since Ellusive 1.0 * * @return void */ function ellusive_remove_upsells() { remove_action( 'woocommerce_after_single_product_summary', 'woocommerce_upsell_display', 15 ); } endif; add_action( 'init', 'ellusive_remove_upsells' ); if ( ! function_exists( 'ellusive_hide_store_templates_from_template_picker' ) ) : /** * Keeps store templates out of the post editor's "Change template" picker. * * Core treats every non-hierarchy template file without a postTypes * declaration as available for all post types, so the theme's WooCommerce * template overrides (Product Catalog, Page: Cart, Single Product, …) are * offered as page, post and product templates. WooCommerce routes to them by * URL, not by template assignment, so they never make sense there. Only * queries that specify a post_type come from the picker, so the Site Editor * listings are unaffected and the templates stay editable there. * * @since Ellusive 1.0 * * @param WP_Block_Template[] $templates Found templates. * @param array $query Template query arguments. * @param string $template_type wp_template or wp_template_part. * @return WP_Block_Template[] */ function ellusive_hide_store_templates_from_template_picker( $templates, $query, $template_type ) { if ( 'wp_template' !== $template_type || empty( $query['post_type'] ) ) { return $templates; } $hidden_template_slugs = array( 'archive-product', 'coming-soon', 'order-confirmation', 'page-cart', 'page-checkout', 'product-search-results', 'single-product', 'taxonomy-product_attribute', ); return array_values( array_filter( $templates, static function ( $template ) use ( $hidden_template_slugs ) { return ! in_array( $template->slug, $hidden_template_slugs, true ); } ) ); } endif; add_filter( 'get_block_templates', 'ellusive_hide_store_templates_from_template_picker', 20, 3 );