classes; if ( ! is_array( $classes ) ) { continue; } if ( in_array( 'hestia-mega-menu', $classes, true ) || in_array( 'hestia-mm-col', $classes, true ) || in_array( 'hestia-mm-heading', $classes, true ) ) { $should_load = true; break; } } if ( $should_load ) { if ( is_rtl() ) { wp_enqueue_style( 'hestia-mega-menu-rtl', get_template_directory_uri() . '/assets/css/mega-menu-rtl' . ( ( HESTIA_DEBUG ) ? '' : '.min' ) . '.css', array(), HESTIA_VERSION ); } else { wp_enqueue_style( 'hestia-mega-menu', get_template_directory_uri() . '/assets/css/mega-menu' . ( ( HESTIA_DEBUG ) ? '' : '.min' ) . '.css', array(), HESTIA_VERSION ); } } return true; } /** * Render navigation */ public function navigation() { if ( apply_filters( 'hestia_filter_components_toggle', false, 'header' ) === true ) { return; } $nav_classes = $this->header_classes(); ?> get_transparent_nav_class(); $class .= $this->get_nav_alignment_class(); $class .= $this->get_full_screen_menu_class(); $class .= $this->get_top_bar_enabled_class(); $disabled_frontpage = get_theme_mod( 'disable_frontpage_sections', false ); $disabled_big_title = get_theme_mod( 'hestia_big_title_hide', false ); $is_blog_frontpage = get_option( 'show_on_front' ) !== 'page' && is_front_page(); if ( ! is_front_page() || $is_blog_frontpage || $disabled_frontpage || $disabled_big_title ) { $class .= ' navbar-not-transparent'; } return $class; } /** * Get the header alignment class. * * @return string */ private function get_nav_alignment_class() { $header_alignment = get_theme_mod( 'hestia_header_alignment', apply_filters( 'hestia_header_alignment_default', 'left' ) ); if ( ! empty( $header_alignment ) ) { return ' hestia_' . $header_alignment; } return ''; } /** * Render primary menu markup. */ private function render_primary_menu() { wp_nav_menu( array( 'theme_location' => 'primary', 'container' => 'div', 'container_class' => 'collapse navbar-collapse', 'container_id' => 'main-navigation', 'menu_class' => 'nav navbar-nav', 'fallback_cb' => 'Hestia_Bootstrap_Navwalker::fallback', 'walker' => new Hestia_Bootstrap_Navwalker(), ) ); } /** * Render navbar toggle markup. */ private function render_navbar_toggle() { if ( ! has_nav_menu( 'primary' ) ) { return; } ?>
'; if ( is_active_sidebar( 'header-sidebar' ) ) { ?> '; return true; } /** * Get class if navbar should be transparent. * * @return string */ private function get_transparent_nav_class() { $class = ' navbar-color-on-scroll navbar-transparent'; $disabled_frontpage = get_theme_mod( 'disable_frontpage_sections', false ); if ( true === (bool) $disabled_frontpage ) { $class = ''; } if ( get_option( 'show_on_front' ) !== 'page' ) { $class = ''; } if ( ! is_front_page() ) { $class = ''; } if ( is_front_page() && is_home() ) { return ''; } if ( is_page_template() && ! get_option( 'fresh_site' ) ) { $class = ''; } $is_nav_transparent = get_theme_mod( 'hestia_navbar_transparent', apply_filters( 'hestia_navbar_transparent_default', true ) ); if ( ! $is_nav_transparent ) { $class = ''; } $hestia_navbar_transparent = get_theme_mod( 'hestia_big_title_hide', false ); if ( $hestia_navbar_transparent ) { $class = ' no-slider'; } return $class; } /** * Get the full screen menu class. * * @return string */ private function get_full_screen_menu_class() { if ( $this->is_full_screen_menu() ) { return ' full-screen-menu'; } return ''; } /** * Utility to check if is full screen menu. * * @return bool */ protected function is_full_screen_menu() { $has_full_screen_menu = get_theme_mod( 'hestia_full_screen_menu', false ); if ( (bool) $has_full_screen_menu === true ) { return true; } return false; } /** * Get the header class if top bar is enabled. * * @return string */ private function get_top_bar_enabled_class() { $is_top_bar_hidden = get_theme_mod( 'hestia_top_bar_hide', true ); if ( (bool) $is_top_bar_hidden === false ) { return ' header-with-topbar'; } return ''; } /** * Do the navbar header. */ private function navbar_header() { ?> ' . get_bloginfo( 'name' ) . ''; $transparent_header = get_theme_mod( 'hestia_navbar_transparent', apply_filters( 'hestia_navbar_transparent_default', true ) ); $main_logo = wp_get_attachment_image_src( get_theme_mod( 'custom_logo' ), 'full' ); if ( ! empty( $main_logo ) && is_array( $main_logo ) ) { $main_logo = $main_logo[0]; } $transparent_logo = wp_get_attachment_image_src( get_theme_mod( 'hestia_transparent_header_logo' ), 'full' ); if ( ! empty( $transparent_logo ) && is_array( $transparent_logo ) ) { $transparent_logo = $transparent_logo[0]; } if ( empty( $main_logo ) && ( empty( $transparent_logo ) || $transparent_header === false ) ) { return $logo; } /** * Make transparent logo as default logo if main logo is missing. */ if ( empty( $main_logo ) && ! empty( $transparent_logo ) && $transparent_header === true ) { $logo = ' '; } if ( ! empty( $main_logo ) ) { $class = ! empty( $transparent_logo ) ? 'class="hestia-hide-if-transparent"' : ''; $alt_attribute = get_post_meta( get_theme_mod( 'custom_logo' ), '_wp_attachment_image_alt', true ); $alt_attribute = ! empty( $alt_attribute ) ? $alt_attribute : get_bloginfo( 'name' ); $logo = ''; } if ( ! empty( $transparent_logo ) && $transparent_header === true ) { $transparent_logo_attachment_id = attachment_url_to_postid( $transparent_logo ); $transparent_logo_alt_attribute = get_post_meta( $transparent_logo_attachment_id, '_wp_attachment_image_alt', true ); $transparent_logo_alt_attribute = ! empty( $transparent_logo_alt_attribute ) ? $transparent_logo_alt_attribute : get_bloginfo( 'name' ); $logo .= ''; } return $logo; } /** * Filter Primary Navigation to add navigation cart and search. * * @param string $markup the markup for the navigation addons. * * @access public * @return mixed */ public function modify_primary_menu( $markup ) { if ( 'primary' !== $markup['theme_location'] ) { return $markup; } $markup['items_wrap'] = $this->display_filtered_navigation(); return $markup; } /** * Display navigation. * * @return string */ private function display_filtered_navigation() { $nav = '