" data-fixed-height="<?php echo esc_attr(et_get_option('fixed_nav_logo_height', '51')); ?> "> <img src="<?php echo esc_attr($logo); ?> " alt="<?php echo esc_attr(get_bloginfo('name')); ?> " id="logo" /> </a> <?php } $et_navigation_classes = extra_classes(array(extra_customizer_selector_classes(extra_get_dynamic_selector('main-navigation'))), 'main-navigation', false); ?> <!-- ET Navigation --> <div id="et-navigation" class="<?php echo $et_navigation_classes; ?> "> <?php $menu_class = 'nav'; if ('on' == et_get_option('extra_disable_toptier')) { $menu_class .= ' et_disable_top_tier'; } $primary_nav = wp_nav_menu(array('theme_location' => 'primary-menu', 'container' => '', 'fallback_cb' => '', 'menu_class' => 'nav', 'menu_id' => 'et-menu', 'echo' => false, 'walker' => new Extra_Walker_Nav_Menu(), 'header_search_field_alone' => $header_vars['header_search_field_alone'], 'header_cart_total_alone' => $header_vars['header_cart_total_alone'])); if (!$primary_nav) { ?>
function extra_customizer_selector_classes($selector, $return_array = true) { $all_settings = extra_get_customizer_value_bound_settings(); $classes = array(); foreach ($all_settings as $setting => $setting_options) { if ('class_toggle' == $setting_options['value_bind']['style']) { if ($selector == $setting_options['value_bind']['selector']) { $class = !empty($setting_options['value_bind']['class']) ? $setting_options['value_bind']['class'] : $setting; $default = !empty($setting_options['default']) ? $setting_options['default'] : false; $value = et_get_option($setting, $default); if ('_value_bind_to_value' == $class) { if (!empty($setting_options['value_bind']['format'])) { $class = str_ireplace('%value%', $value, $setting_options['value_bind']['format']); } else { $class = $value; } } if (!empty($value)) { $classes[] = $class; } } } } $classes = extra_classes($classes, $selector); if (empty($classes)) { return; } return $return_array ? $classes : implode(' ', $classes); }
function extra_get_header_vars() { $items = array(); $header_items = array('header_social_icons', 'header_search_field', 'header_cart_total'); foreach ($header_items as $header_item) { $items['show_' . $header_item] = extra_customizer_el_visible(extra_get_dynamic_selector($header_item)); $items['output_' . $header_item] = $items['show_' . $header_item] || is_customize_preview(); } $items['show_header_trending_bar'] = et_get_option('show_header_trending', 'on'); $items['output_header_trending_bar'] = $items['show_header_trending_bar'] || is_customize_preview(); $items['header_search_field_alone'] = false; $items['header_cart_total_alone'] = false; $items['secondary_nav'] = wp_nav_menu(array('theme_location' => 'secondary-menu', 'container' => '', 'fallback_cb' => '', 'menu_class' => 'nav', 'menu_id' => 'et-secondary-menu', 'echo' => false)); $trending_posts = new WP_Query(apply_filters('extra_trending_posts_query', array('post_type' => 'post', 'post_status' => 'publish', 'posts_per_page' => '3', 'orderby' => 'comment_count', 'order' => 'DESC'))); $items['trending_posts'] = isset($trending_posts->posts) ? $trending_posts : false; $items['top_info_defined'] = false; $top_info_items = array('show_header_social_icons', 'secondary_nav', 'show_header_trending_bar', 'show_header_search_field', 'show_header_cart_total'); $top_info_items_count = 0; foreach ($top_info_items as $top_info_item) { if (!empty($items[$top_info_item])) { $top_info_items_count++; $items['top_info_defined'] = true; } } if (1 == $top_info_items_count) { if (!empty($items['show_header_search_field'])) { $items['header_search_field_alone'] = true; $items['show_header_search_field'] = false; } if (!empty($items['show_header_cart_total'])) { $items['header_cart_total_alone'] = true; $items['show_header_cart_total'] = false; } if ($items['header_search_field_alone'] || $items['header_cart_total_alone']) { $items['top_info_defined'] = false; add_filter('wp_nav_menu_items', 'extra_primary_nav_extended_items', 10, 2); } } elseif (is_customize_preview()) { add_filter('wp_nav_menu_items', 'extra_primary_nav_extended_items', 10, 2); } $items['header_style'] = et_get_option('header_style', 'left-right'); $items['header_ad'] = extra_display_ad('header', false); $header_classes = array(); if (!empty($items['header_style']) && 'centered' == $items['header_style']) { $header_classes[] = 'centered'; } else { $header_classes[] = 'left-right'; } if (!empty($header_ad)) { $header_classes[] = 'has_headerad'; } $items['header_classes'] = extra_classes($header_classes, 'header', false); return $items; }