800, 'single_image_width' => 800, ) ) ); add_theme_support( 'wc-product-gallery-zoom' ); add_theme_support( 'wc-product-gallery-lightbox' ); add_theme_support( 'wc-product-gallery-slider' ); add_theme_support( 'title-tag' ); add_theme_support( 'automatic-feed-links' ); add_theme_support( 'align-wide' ); add_theme_support( 'custom-background', array() ); add_theme_support( 'custom-header', array() ); add_theme_support( 'custom-logo', array() ); add_theme_support( 'html5', array( 'comment-list', 'comment-form', 'search-form', 'gallery', 'caption', 'style', 'script' ) ); add_theme_support( 'wp-block-styles' ); add_theme_support( 'post-thumbnails' ); } public static function get_locations() { return array_merge( self::get_main_locations(), self::get_header_locations(), self::get_footer_locations() ); } public static function get_main_locations() { return array( 'primary-menu' => __( 'Primary Menu', 'brandy' ), 'secondary-menu' => __( 'Secondary Menu', 'brandy' ), ); } public static function get_header_locations() { return array( 'header-menu-1' => __( 'Header Menu 1', 'brandy' ), 'header-menu-2' => __( 'Header Menu 2', 'brandy' ), ); } public static function get_footer_locations() { return array( 'footer-menu-1' => __( 'Footer Menu 1', 'brandy' ), 'footer-menu-2' => __( 'Footer Menu 2', 'brandy' ), ); } public function register_menus() { register_nav_menus( self::get_locations() ); } public function unregister_patterns_when_necessary() { if ( is_wc_installed() ) { return; } $themes = array(); $theme = wp_get_theme(); $themes[] = $theme; if ( $theme->parent() ) { $themes[] = $theme->parent(); } $patterns = array(); foreach ( $themes as $theme ) { $patterns = array_merge( $patterns, $theme->get_block_patterns() ); } foreach ( $patterns as $pattern_name => $pattern ) { if ( empty( $pattern['categories'] ) ) { continue; } if ( in_array( 'woocommerce', $pattern['categories'], true ) ) { unregister_block_pattern( $pattern['slug'] ); } if ( 'brandy/simple-contact-form' === $pattern['slug'] ) { unregister_block_pattern( $pattern['slug'] ); } } } public function remove_wc_templates_when_necessary( $query_result ) { if ( is_wc_installed() ) { return $query_result; } $removal_template_slugs = array( 'archive-product', 'order-confirmation', 'page-cart', 'page-checkout', 'page-my-account', 'product-search-results', 'single-product', ); $query_result = array_filter( $query_result, function( $template ) use ( $removal_template_slugs ) { if ( false === strpos( $template->theme, 'brandy' ) && false === strpos( $template->id, 'brandy' ) ) { return true; } return ! in_array( $template->slug, $removal_template_slugs, true ); } ); return $query_result; } } ThemeSetup::get_instance();