theme_location == 'primary' && ! thegem_get_option( 'hide_search_icon' ) ) { $items .= ''; } return $items; }, 10, 2 ); // Header Fullwidth hamburger remove_filter( 'wp_nav_menu_items', 'thegem_menu_item_hamburger_widget', 100, 2 ); add_action( 'thegem_before_nav_menu', function () { if ( in_array( thegem_get_option( 'header_layout' ), array( 'perspective', 'fullwidth_hamburger', 'overlay' ) ) ) { echo do_shortcode( '[fibosearch]' ); } } ); // Perspective header remove_filter( 'get_search_form', 'thegem_serch_form_vertical_header' ); add_action( 'thegem_perspective_menu_buttons', function () { echo do_shortcode( '[fibosearch]' ); } ); // Remove the search bar from vertical header add_filter( 'get_search_form', function ( $form ) { if ( in_array( thegem_get_option( 'header_layout' ), array( 'fullwidth_hamburger', 'vertical' ) ) ) { $form = ''; } return $form; }, 100 ); add_action( 'thegem_before_header', function () { if ( ! in_array( thegem_get_option( 'header_layout' ), array( 'vertical' ) ) ) { return; } $html = ''; echo $html; }, 20 ); // Force enable overlay for mobile search add_filter( 'dgwt/wcas/settings/load_value/key=enable_mobile_overlay', function () { return 'on'; } ); } else { // Header Builder. function dgwtWcasTheGemGetCustomCss( $atts, $uniqid ) { $defaultAtts = [ 'desktop_disable' => '', 'tablet_disable' => '', 'mobile_disable' => '', ]; if ( function_exists( 'thegem_templates_extra_options_extract' ) && function_exists( 'thegem_templates_design_options_extract' ) ) { $defaultAtts = array_merge( thegem_templates_extra_options_extract(), thegem_templates_design_options_extract() ); } $atts = wp_parse_args( $atts, $defaultAtts ); return thegem_templates_element_design_options( $uniqid, '.dgwt-wcas-search-wrapp', $atts ); } add_shortcode( 'thegem_te_search_form', function ( $atts, $content, $shortcodeTag ) { $uniqid = uniqid( 'thegem-custom-' ) . rand( 1, 9999 ); $customCss = dgwtWcasTheGemGetCustomCss( $atts, $uniqid ); $cssOutput = empty( $customCss ) ? '' : ''; return $cssOutput . do_shortcode( '[fibosearch layout="classic" class="' . $uniqid . '"]' ); } ); add_shortcode( 'thegem_te_search', function ( $atts, $content, $shortcodeTag ) { $uniqid = uniqid( 'thegem-custom-' ) . rand( 1, 9999 ); $customCss = dgwtWcasTheGemGetCustomCss( $atts, $uniqid ); if ( isset( $atts['icon_size'] ) ) { $customCss .= ".$uniqid .dgwt-wcas-ico-magnifier, .$uniqid .dgwt-wcas-ico-magnifier-handler{max-height:" . $atts['icon_size'] . "px;}"; } if ( isset( $atts['icon_color_normal'] ) ) { $customCss .= ".$uniqid .dgwt-wcas-ico-magnifier, .$uniqid .dgwt-wcas-ico-magnifier-handler{fill:" . $atts['icon_color_normal'] . ";}"; } if ( isset( $atts['icon_color_hover'] ) ) { $customCss .= ".$uniqid:hover .dgwt-wcas-ico-magnifier, .$uniqid:hover .dgwt-wcas-ico-magnifier-handler{fill:" . $atts['icon_color_hover'] . ";}"; } $cssOutput = empty( $customCss ) ? '' : ''; return $cssOutput . do_shortcode( '[fibosearch layout="icon" class="' . $uniqid . '"]' ); } ); } } ); /** * Forcing our engine to run when WooCommerce >> Shop grid >> Layout Type is "Products Grid". */ add_filter( 'dgwt/wcas/helpers/is_search_query', function ( $enabled, $query ) { if ( $query->get( 'post_type' ) && is_string( $query->get( 'post_type' ) ) && $query->get( 'post_type' ) === 'product' && is_string( $query->get( 's' ) ) && strlen( $query->get( 's' ) ) > 0 && Helpers::isRunningInsideFunction( 'thegem_extended_products_get_posts', 25 ) ) { $enabled = true; } return $enabled; }, 10, 2 ); add_action( 'wp_head', function () { $headerSource = thegem_get_option( 'header_source', 'default' ); $color = thegem_get_option( 'main_menu_level1_color' ); $colorHover = thegem_get_option( 'main_menu_level1_hover_color' ); $mobileColor = thegem_get_option( 'mobile_menu_level1_color' ); // Built-in Header. if ( $headerSource === 'default' ) { ?>