/wp-content/themes/Avada/templates/header.php

https://gitlab.com/webkod3r/tripolis · PHP · 544 lines · 429 code · 64 blank · 51 comment · 147 complexity · b138f2d2be23d9bbf98df7514895994e MD5 · raw file

  1. <?php
  2. if ( ! function_exists( 'avada_header_template' ) ) {
  3. /**
  4. * Avada Header Template Function
  5. * @param string $slider_position Show header below or above slider
  6. * @return void
  7. */
  8. function avada_header_template( $slider_position = 'Below' ) {
  9. $page_id = get_queried_object_id();
  10. $reverse_position = ( 'Below' == $slider_position ) ? 'Above' : 'Below';
  11. $menu_text_align = '';
  12. $theme_option_slider_position = Avada()->settings->get( 'slider_position' );
  13. $page_option_slider_position = fusion_get_page_option( 'slider_position', $page_id );
  14. if ( ( ! $theme_option_slider_position || ( $theme_option_slider_position == $slider_position && $page_option_slider_position != strtolower( $reverse_position ) ) || ( $theme_option_slider_position != $slider_position && $page_option_slider_position == strtolower( $slider_position ) ) ) && ! is_page_template( 'blank.php' ) && fusion_get_page_option( 'display_header', $page_id ) != 'no' && Avada()->settings->get( 'header_position' ) == 'Top' ) {
  15. $header_wrapper_class = 'fusion-header-wrapper';
  16. $header_wrapper_class .= ( Avada()->settings->get( 'header_shadow' ) ) ? ' fusion-header-shadow' : '';
  17. $header_wrapper_class = 'class="' . $header_wrapper_class . '"';
  18. /**
  19. * avada_before_header_wrapper hook
  20. */
  21. do_action( 'avada_before_header_wrapper' );
  22. $sticky_header_logo = ( Avada()->settings->get( 'sticky_header_logo' ) ) ? true : false;
  23. $mobile_logo = ( Avada()->settings->get( 'mobile_logo' ) ) ? true : false;
  24. $sticky_header_type2_layout = '';
  25. if ( in_array( Avada()->settings->get( 'header_layout' ), array( 'v4', 'v5' ) ) ) {
  26. $sticky_header_type2_layout = ( 'menu_and_logo' == Avada()->settings->get( 'header_sticky_type2_layout' ) ) ? ' fusion-sticky-menu-and-logo' : ' fusion-sticky-menu-only';
  27. $menu_text_align = 'fusion-header-menu-align-' . Avada()->settings->get( 'menu_text_align' );
  28. }
  29. ?>
  30. <div <?php echo $header_wrapper_class; ?>>
  31. <div class="<?php echo sprintf( 'fusion-header-%s fusion-logo-%s fusion-sticky-menu-%s fusion-sticky-logo-%s fusion-mobile-logo-%s fusion-mobile-menu-design-%s%s %s', Avada()->settings->get( 'header_layout' ), strtolower( Avada()->settings->get( 'logo_alignment' ) ), has_nav_menu( 'sticky_navigation' ), $sticky_header_logo, $mobile_logo, strtolower( Avada()->settings->get( 'mobile_menu_design' ) ), $sticky_header_type2_layout, $menu_text_align ); ?>">
  32. <?php
  33. /**
  34. * avada_header hook
  35. * @hooked avada_secondary_header - 10
  36. * @hooked avada_header_1 - 20 (adds header content for header v1-v3)
  37. * @hooked avada_header_2 - 20 (adds header content for header v4-v5)
  38. */
  39. do_action( 'avada_header' );
  40. ?>
  41. </div>
  42. <div class="fusion-clearfix"></div>
  43. </div>
  44. <?php
  45. /**
  46. * avada_after_header_wrapper hook
  47. */
  48. do_action( 'avada_after_header_wrapper' );
  49. }
  50. }
  51. }
  52. if ( ! function_exists( 'avada_side_header' ) ) {
  53. /**
  54. * Avada Side Header Template Function
  55. * @return void
  56. */
  57. function avada_side_header() {
  58. $queried_object_id = get_queried_object_id();
  59. if ( ! is_page_template( 'blank.php' ) && 'no' != get_post_meta( $queried_object_id, 'pyre_display_header', true ) ) : ?>
  60. <?php
  61. /**
  62. * avada_before_header_wrapper hook
  63. */
  64. do_action( 'avada_before_header_wrapper' );
  65. $sticky_header_logo = ( Avada()->settings->get( 'sticky_header_logo' ) ) ? true : false;
  66. $mobile_logo = ( Avada()->settings->get( 'mobile_logo' ) ) ? true : false;
  67. ?>
  68. <div id="side-header-sticky"></div>
  69. <div id="side-header" class="clearfix fusion-mobile-menu-design-<?php echo strtolower( Avada()->settings->get( 'mobile_menu_design' ) ); ?> fusion-sticky-logo-<?php echo $sticky_header_logo; ?> fusion-mobile-logo-<?php echo $mobile_logo; ?> fusion-sticky-menu-<?php echo has_nav_menu( 'sticky_navigation' ); ?><?php echo ( Avada()->settings->get( 'header_shadow' ) ) ? ' header-shadow' : ''; ?>">
  70. <div class="side-header-wrapper">
  71. <?php
  72. /**
  73. * avada_header_inner_before
  74. */
  75. do_action( 'avada_header_inner_before' );
  76. ?>
  77. <?php $mobile_logo = ( Avada()->settings->get( 'mobile_logo' ) ) ? true : false; ?>
  78. <div class="side-header-content fusion-logo-<?php echo strtolower( Avada()->settings->get( 'logo_alignment' ) ); ?> fusion-mobile-logo-<?php echo $mobile_logo; ?>">
  79. <?php avada_logo(); ?>
  80. </div>
  81. <div class="fusion-main-menu-container fusion-logo-menu-<?php echo strtolower( Avada()->settings->get( 'logo_alignment' ) ); ?>">
  82. <?php avada_main_menu(); ?>
  83. </div>
  84. <?php if ( 'Tagline And Search' == Avada()->settings->get( 'header_v4_content' ) || 'Search' == Avada()->settings->get( 'header_v4_content' ) ) : ?>
  85. <div class="fusion-secondary-menu-search">
  86. <div class="fusion-secondary-menu-search-inner"><?php get_search_form(); ?></div>
  87. </div>
  88. <?php endif; ?>
  89. <?php if ( 'Leave Empty' != Avada()->settings->get( 'header_left_content' ) || 'Leave Empty' != Avada()->settings->get( 'header_right_content' ) ) : ?>
  90. <?php $content_1 = avada_secondary_header_content( 'header_left_content' ); ?>
  91. <?php $content_2 = avada_secondary_header_content( 'header_right_content' ); ?>
  92. <div class="side-header-content side-header-content-1-2">
  93. <?php if ( $content_1 ) : ?>
  94. <div class="side-header-content-1 fusion-clearfix"><?php echo $content_1; ?></div>
  95. <?php endif; ?>
  96. <?php if ( $content_2 ) : ?>
  97. <div class="side-header-content-2 fusion-clearfix"><?php echo $content_2; ?></div>
  98. <?php endif; ?>
  99. </div>
  100. <?php endif; ?>
  101. <?php if ( 'None' != Avada()->settings->get( 'header_v4_content' ) ) : ?>
  102. <div class="side-header-content side-header-content-3">
  103. <?php avada_header_content_3(); ?>
  104. </div>
  105. <?php endif; ?>
  106. <?php
  107. /**
  108. * avada_header_inner_after
  109. */
  110. do_action( 'avada_header_inner_after' );
  111. ?>
  112. </div>
  113. <div class="side-header-background"></div>
  114. <div class="side-header-border"></div>
  115. </div>
  116. <?php
  117. /**
  118. * avada_after_header_wrapper hook
  119. */
  120. do_action( 'avada_after_header_wrapper' );
  121. ?>
  122. <?php endif;
  123. }
  124. }
  125. if ( ! function_exists( 'avada_secondary_header' ) ) {
  126. function avada_secondary_header() {
  127. if ( ! in_array( Avada()->settings->get( 'header_layout' ), array( 'v2', 'v3', 'v4', 'v5' ) ) ) {
  128. return;
  129. }
  130. ?>
  131. <?php if ( 'Leave Empty' != Avada()->settings->get( 'header_left_content' ) || 'Leave Empty' != Avada()->settings->get( 'header_right_content' ) ) : ?>
  132. <?php $content_1 = avada_secondary_header_content( 'header_left_content' ); ?>
  133. <?php $content_2 = avada_secondary_header_content( 'header_right_content' ); ?>
  134. <div class="fusion-secondary-header">
  135. <div class="fusion-row">
  136. <?php if ( $content_1 ) : ?>
  137. <div class="fusion-alignleft"><?php echo $content_1; ?></div>
  138. <?php endif; ?>
  139. <?php if ( $content_2 ) : ?>
  140. <div class="fusion-alignright"><?php echo $content_2; ?></div>
  141. <?php endif; ?>
  142. </div>
  143. </div>
  144. <?php endif;
  145. }
  146. }
  147. add_action( 'avada_header', 'avada_secondary_header', 10 );
  148. if ( ! function_exists( 'avada_header_1' ) ) {
  149. function avada_header_1() {
  150. if ( ! in_array( Avada()->settings->get( 'header_layout' ), array( 'v1', 'v2', 'v3' ) ) ) {
  151. return;
  152. }
  153. ?>
  154. <div class="fusion-header-sticky-height"></div>
  155. <div class="fusion-header">
  156. <div class="fusion-row">
  157. <?php avada_logo(); ?>
  158. <?php avada_main_menu(); ?>
  159. </div>
  160. </div>
  161. <?php
  162. }
  163. }
  164. add_action( 'avada_header', 'avada_header_1', 20 );
  165. if ( ! function_exists( 'avada_header_2' ) ) {
  166. function avada_header_2() {
  167. if ( ! in_array( Avada()->settings->get( 'header_layout' ), array( 'v4', 'v5' ) ) ) {
  168. return;
  169. }
  170. ?>
  171. <div class="fusion-header-sticky-height"></div>
  172. <div class="fusion-sticky-header-wrapper"> <!-- start fusion sticky header wrapper -->
  173. <div class="fusion-header">
  174. <div class="fusion-row">
  175. <?php avada_logo(); ?>
  176. <?php echo avada_modern_menu(); ?>
  177. </div>
  178. </div>
  179. <?php
  180. }
  181. }
  182. add_action( 'avada_header', 'avada_header_2', 20 );
  183. if ( ! function_exists( 'avada_secondary_main_menu' ) ) {
  184. function avada_secondary_main_menu() {
  185. if ( ! in_array( Avada()->settings->get( 'header_layout' ), array( 'v4', 'v5' ) ) ) {
  186. return;
  187. }
  188. ?>
  189. <div class="fusion-secondary-main-menu">
  190. <div class="fusion-row">
  191. <?php avada_main_menu(); ?>
  192. <?php if ( 'v4' == Avada()->settings->get( 'header_layout' ) ) : ?>
  193. <?php $header_content_3 = Avada()->settings->get( 'header_v4_content' ); ?>
  194. <?php if ( 'Tagline And Search' == $header_content_3 ) : ?>
  195. <div class="fusion-secondary-menu-search"><?php echo get_search_form( false ); ?></div>
  196. <?php elseif ( 'Search' == $header_content_3 ) : ?>
  197. <div class="fusion-secondary-menu-search"><?php echo get_search_form( false ); ?></div>
  198. <?php endif; ?>
  199. <?php endif; ?>
  200. </div>
  201. </div>
  202. </div> <!-- end fusion sticky header wrapper -->
  203. <?php }
  204. }
  205. add_action( 'avada_header', 'avada_secondary_main_menu', 30 );
  206. if ( ! function_exists( 'avada_logo' ) ) {
  207. function avada_logo() {
  208. /**
  209. * No need to proceed any further if no logo is set
  210. */
  211. if ( '' == Avada()->settings->get( 'logo' ) && '' == Avada()->settings->get( 'logo_retina' ) ) {
  212. return;
  213. }
  214. ?>
  215. <div class="fusion-logo" data-margin-top="<?php echo intval( Avada()->settings->get( 'margin_logo_top' ) ); ?>px" data-margin-bottom="<?php echo intval( Avada()->settings->get( 'margin_logo_bottom' ) ); ?>px" data-margin-left="<?php echo intval( Avada()->settings->get( 'margin_logo_left' ) ); ?>px" data-margin-right="<?php echo intval( Avada()->settings->get( 'margin_logo_right' ) ); ?>px">
  216. <?php
  217. /**
  218. * avada_logo_prepend hook
  219. */
  220. do_action( 'avada_logo_prepend' );
  221. ?>
  222. <?php if ( Avada()->settings->get( 'logo' ) ) : ?>
  223. <a class="fusion-logo-link" href="<?php echo home_url(); ?>">
  224. <?php $logo_url = Avada_Sanitize::get_url_with_correct_scheme( Avada()->settings->get( 'logo' ) ); ?>
  225. <?php if ( Avada()->settings->get( 'retina_logo_width' ) && Avada()->settings->get( 'retina_logo_height' ) ) : ?>
  226. <?php $logo_size['width'] = fusion_strip_unit( Avada()->settings->get( 'retina_logo_width' ) ); ?>
  227. <?php $logo_size['height'] = fusion_strip_unit( Avada()->settings->get( 'retina_logo_height' ) ); ?>
  228. <?php else : ?>
  229. <?php $logo_size['width'] = ''; ?>
  230. <?php $logo_size['height'] = ''; ?>
  231. <?php endif; ?>
  232. <img src="<?php echo $logo_url; ?>" width="<?php echo $logo_size['width']; ?>" height="<?php echo $logo_size['height']; ?>" alt="<?php bloginfo( 'name' ); ?>" class="fusion-logo-1x fusion-standard-logo" />
  233. <?php $retina_logo = Avada()->settings->get( 'logo_retina' ); ?>
  234. <?php if ( $retina_logo ) : ?>
  235. <?php $retina_logo = Avada_Sanitize::get_url_with_correct_scheme( $retina_logo ); ?>
  236. <?php $style = 'style="max-height: ' . $logo_size['height'] . 'px; height: auto;"'; ?>
  237. <img src="<?php echo $retina_logo; ?>" width="<?php echo $logo_size['width']; ?>" height="<?php echo $logo_size['height']; ?>" alt="<?php bloginfo('name'); ?>" <?php echo $style; ?> class="fusion-standard-logo fusion-logo-2x" />
  238. <?php else: ?>
  239. <img src="<?php echo $logo_url; ?>" width="<?php echo $logo_size['width']; ?>" height="<?php echo $logo_size['height']; ?>" alt="<?php bloginfo('name'); ?>" class="fusion-standard-logo fusion-logo-2x" />
  240. <?php endif; ?>
  241. <!-- mobile logo -->
  242. <?php if ( Avada()->settings->get( 'mobile_logo' ) ) : ?>
  243. <?php $mobile_logo = Avada_Sanitize::get_url_with_correct_scheme( Avada()->settings->get( 'mobile_logo' ) ); ?>
  244. <img src="<?php echo $mobile_logo; ?>" alt="<?php bloginfo( 'name' ); ?>" class="fusion-logo-1x fusion-mobile-logo-1x" />
  245. <?php $retina_logo = Avada()->settings->get( 'mobile_logo_retina' ); ?>
  246. <?php if ( $retina_logo ) : ?>
  247. <?php $retina_logo = Avada_Sanitize::get_url_with_correct_scheme( $retina_logo ); ?>
  248. <?php if ( Avada()->settings->get( 'mobile_retina_logo_width' ) && Avada()->settings->get( 'mobile_retina_logo_height' ) ) : ?>
  249. <?php $logo_size['width'] = fusion_strip_unit( Avada()->settings->get( 'mobile_retina_logo_width' ) ); ?>
  250. <?php $logo_size['height'] = fusion_strip_unit( Avada()->settings->get( 'mobile_retina_logo_height' ) ); ?>
  251. <?php else : ?>
  252. <?php $logo_size['width'] = ''; ?>
  253. <?php $logo_size['height'] = ''; ?>
  254. <?php endif; ?>
  255. <?php $style = 'style="max-height: ' . $logo_size['height'] . 'px; height: auto;"'; ?>
  256. <img src="<?php echo $retina_logo; ?>" alt="<?php bloginfo('name'); ?>" <?php echo $style; ?> class="fusion-logo-2x fusion-mobile-logo-2x" />
  257. <?php else: ?>
  258. <img src="<?php echo Avada()->settings->get( 'mobile_logo' ); ?>" alt="<?php bloginfo( 'name' ); ?>" class="fusion-logo-2x fusion-mobile-logo-2x" />
  259. <?php endif; ?>
  260. <?php endif; ?>
  261. <!-- sticky header logo -->
  262. <?php if ( Avada()->settings->get( 'sticky_header_logo' ) && ( in_array( Avada()->settings->get( 'header_layout' ), array( 'v1', 'v2', 'v3' ) ) || ( ( in_array( Avada()->settings->get( 'header_layout' ), array( 'v4', 'v5' ) ) && Avada()->settings->get( 'header_sticky_type2_layout' ) == 'menu_and_logo' ) ) ) ) : ?>
  263. <?php $sticky_logo = Avada_Sanitize::get_url_with_correct_scheme( Avada()->settings->get( 'sticky_header_logo' ) ); ?>
  264. <img src="<?php echo $sticky_logo; ?>" alt="<?php bloginfo( 'name' ); ?>" class="fusion-logo-1x fusion-sticky-logo-1x" />
  265. <?php $retina_logo = Avada()->settings->get( 'sticky_header_logo_retina' ); ?>
  266. <?php if ( $retina_logo ) : ?>
  267. <?php $retina_logo = Avada_Sanitize::get_url_with_correct_scheme( $retina_logo ); ?>
  268. <?php if ( Avada()->settings->get( 'sticky_retina_logo_width' ) && Avada()->settings->get( 'sticky_retina_logo_height' ) ) : ?>
  269. <?php $logo_size['width'] = fusion_strip_unit( Avada()->settings->get( 'sticky_retina_logo_width' ) ); ?>
  270. <?php $logo_size['height'] = fusion_strip_unit( Avada()->settings->get( 'sticky_retina_logo_height' ) ); ?>
  271. <?php else : ?>
  272. <?php $logo_size['width'] = ''; ?>
  273. <?php $logo_size['height'] = ''; ?>
  274. <?php endif; ?>
  275. <?php $style = 'style="max-height: ' . $logo_size['height'] . 'px; height: auto;"'; ?>
  276. <img src="<?php echo $retina_logo; ?>" alt="<?php bloginfo('name'); ?>" <?php echo $style; ?> class="fusion-logo-2x fusion-sticky-logo-2x" />
  277. <?php else : ?>
  278. <img src="<?php echo $sticky_logo; ?>" alt="<?php bloginfo( 'name' ); ?>" class="fusion-logo-2x fusion-sticky-logo-2x" />
  279. <?php endif; ?>
  280. <?php endif; ?>
  281. </a>
  282. <?php endif; ?>
  283. <?php
  284. /**
  285. * avada_logo_append hook
  286. * @hooked avada_header_content_3 - 10
  287. */
  288. do_action( 'avada_logo_append' );
  289. ?>
  290. </div>
  291. <?php
  292. }
  293. }
  294. if ( ! function_exists( 'avada_main_menu' ) ) {
  295. function avada_main_menu() {
  296. wp_nav_menu( array(
  297. 'theme_location' => 'main_navigation',
  298. 'depth' => 5,
  299. 'menu_class' => 'fusion-menu',
  300. 'items_wrap' => '<ul id="%1$s" class="%2$s">%3$s</ul>',
  301. 'fallback_cb' => 'FusionCoreFrontendWalker::fallback',
  302. 'walker' => new FusionCoreFrontendWalker(),
  303. 'container_class' => 'fusion-main-menu'
  304. ) );
  305. if ( has_nav_menu( 'sticky_navigation' ) && ( ! function_exists( 'ubermenu_get_menu_instance_by_theme_location' ) || ( function_exists( 'ubermenu_get_menu_instance_by_theme_location' ) && ! ubermenu_get_menu_instance_by_theme_location( 'sticky_navigation' ) ) ) ) {
  306. wp_nav_menu( array(
  307. 'theme_location' => 'sticky_navigation',
  308. 'depth' => 5,
  309. 'menu_class' => 'fusion-menu',
  310. 'items_wrap' => '<ul id="%1$s" class="%2$s">%3$s</ul>',
  311. 'fallback_cb' => 'FusionCoreFrontendWalker::fallback',
  312. 'walker' => new FusionCoreFrontendWalker(),
  313. 'container_class' => 'fusion-main-menu fusion-sticky-menu'
  314. ) );
  315. }
  316. // Make sure mobile menu is not loaded when ubermenu is used
  317. if ( ! function_exists( 'ubermenu_get_menu_instance_by_theme_location' ) || ( function_exists( 'ubermenu_get_menu_instance_by_theme_location' ) && ! ubermenu_get_menu_instance_by_theme_location( 'main_navigation' ) ) ) {
  318. avada_mobile_main_menu();
  319. }
  320. }
  321. }
  322. if ( ! function_exists( 'avada_default_menu_fallback' ) ) {
  323. function avada_default_menu_fallback( $args ) {
  324. return null;
  325. }
  326. }
  327. if ( ! function_exists( 'avada_contact_info' ) ) {
  328. function avada_contact_info() {
  329. $phone_number = do_shortcode( Avada()->settings->get( 'header_number' ) );
  330. $email = Avada()->settings->get( 'header_email' );
  331. $header_position = Avada()->settings->get( 'header_position' );
  332. $html = '';
  333. if ( $phone_number || $email ) {
  334. $html .= '<div class="fusion-contact-info">';
  335. $html .= $phone_number;
  336. if ( $phone_number && $email ) {
  337. if ( 'Top' == $header_position ) {
  338. $html .= '<span class="fusion-header-separator">' . apply_filters( 'avada_header_separator', '|' ) .'</span>';
  339. } else {
  340. $html .= '<br />';
  341. }
  342. }
  343. $html .= sprintf( apply_filters( 'avada_header_contact_info_email', '<a href="mailto:%s">%s</a>' ), $email, $email );
  344. $html .= '</div>';
  345. }
  346. return $html;
  347. }
  348. }
  349. if ( ! function_exists( 'avada_secondary_nav' ) ) {
  350. function avada_secondary_nav() {
  351. if ( has_nav_menu( 'top_navigation' ) ) {
  352. return wp_nav_menu( array(
  353. 'theme_location' => 'top_navigation',
  354. 'depth' => 5,
  355. 'items_wrap' => '<ul id="%1$s" class="%2$s">%3$s</ul>',
  356. 'container_class' => 'fusion-secondary-menu',
  357. 'fallback_cb' => 'FusionCoreFrontendWalker::fallback',
  358. 'walker' => new FusionCoreFrontendWalker(),
  359. 'echo' => false
  360. ) );
  361. }
  362. }
  363. }
  364. if ( ! function_exists( 'avada_header_social_links' ) ) {
  365. function avada_header_social_links() {
  366. global $social_icons;
  367. $options = array(
  368. 'position' => 'header',
  369. 'icon_colors' => Avada()->settings->get( 'header_social_links_icon_color'),
  370. 'box_colors' => Avada()->settings->get( 'header_social_links_box_color' ),
  371. 'icon_boxed' => Avada()->settings->get( 'header_social_links_boxed' ),
  372. 'icon_boxed_radius' => intval( Avada()->settings->get( 'header_social_links_boxed_radius' ) ) . 'px',
  373. 'tooltip_placement' => Avada()->settings->get( 'header_social_links_tooltip_placement' ),
  374. 'linktarget' => Avada()->settings->get( 'social_icons_new' )
  375. );
  376. $render_social_icons = $social_icons->render_social_icons( $options );
  377. $html = ( $render_social_icons ) ? '<div class="fusion-social-links-header">' . $render_social_icons . '</div>' : '';
  378. return $html;
  379. }
  380. }
  381. if ( ! function_exists( 'avada_secondary_header_content' ) ) {
  382. /**
  383. * Get the secondary header content based on the content area
  384. * @param string $content_area Secondary header content area from theme optins
  385. * @return string Html for the content
  386. */
  387. function avada_secondary_header_content( $content_area ) {
  388. if ( Avada()->settings->get( $content_area ) == 'Contact Info' ) {
  389. return avada_contact_info();
  390. } elseif ( Avada()->settings->get( $content_area ) == 'Social Links' ) {
  391. return avada_header_social_links();
  392. } elseif ( Avada()->settings->get( $content_area ) == 'Navigation' ) {
  393. $mobile_menu_wrapper = '';
  394. if ( has_nav_menu( 'top_navigation' ) ) {
  395. $mobile_menu_wrapper = '<div class="fusion-mobile-nav-holder"></div>';
  396. }
  397. return avada_secondary_nav() . $mobile_menu_wrapper;
  398. }
  399. }
  400. }
  401. if ( ! function_exists( 'avada_header_content_3' ) ) {
  402. function avada_header_content_3() {
  403. if ( 'v4' != Avada()->settings->get( 'header_layout' ) && Avada()->settings->get( 'header_position' ) == 'Top' ) {
  404. return;
  405. }
  406. $header_content_3 = Avada()->settings->get( 'header_v4_content' );
  407. $html = '';
  408. if ( 'Tagline' == $header_content_3 ) {
  409. $html .= avada_header_tagline();
  410. } elseif ( 'Tagline And Search' == $header_content_3 ) {
  411. if ( 'Top' == Avada()->settings->get( 'header_position' ) ) {
  412. if ( 'Right' == Avada()->settings->get( 'logo_alignment' ) ) {
  413. $html .= avada_header_tagline();
  414. $html .= '<div class="fusion-secondary-menu-search">' . get_search_form( false ) . '</div>';
  415. } else {
  416. $html .= '<div class="fusion-secondary-menu-search">' . get_search_form( false ) . '</div>';
  417. $html .= avada_header_tagline();
  418. }
  419. } else {
  420. $html .= avada_header_tagline();
  421. $html .= '<div class="fusion-secondary-menu-search">' . get_search_form( false ) . '</div>';
  422. }
  423. } elseif ( 'Search' == $header_content_3 ) {
  424. $html .= '<div class="fusion-secondary-menu-search">' . get_search_form( false ) . '</div>';
  425. } elseif ( 'Banner' == $header_content_3 ) {
  426. $html .= avada_header_banner();
  427. }
  428. echo '<div class="fusion-header-content-3-wrapper">' . $html . '</div>';
  429. }
  430. }
  431. if ( Avada()->settings->get( 'header_position' ) == 'Top' ) {
  432. add_action( 'avada_logo_append', 'avada_header_content_3', 10 );
  433. }
  434. if ( ! function_exists( 'avada_header_banner' ) ) {
  435. function avada_header_banner() {
  436. return '<div class="fusion-header-banner">' . do_shortcode( Avada()->settings->get( 'header_banner_code' ) ) . '</div>';
  437. }
  438. }
  439. if ( ! function_exists( 'avada_header_tagline' ) ) {
  440. function avada_header_tagline() {
  441. return '<h3 class="fusion-header-tagline">' . do_shortcode( Avada()->settings->get( 'header_tagline' ) ) . '</h3>';
  442. }
  443. }
  444. if ( ! function_exists( 'avada_modern_menu' ) ) {
  445. function avada_modern_menu() {
  446. $html = '';
  447. if ( 'modern' == Avada()->settings->get( 'mobile_menu_design' ) ) {
  448. $header_content_3 = Avada()->settings->get( 'header_v4_content' );
  449. $html .= '<div class="fusion-mobile-menu-icons">';
  450. // Make sure mobile menu toggle is not loaded when ubermenu is used
  451. if ( ! function_exists( 'ubermenu_get_menu_instance_by_theme_location' ) || ( function_exists( 'ubermenu_get_menu_instance_by_theme_location' ) && ! ubermenu_get_menu_instance_by_theme_location( 'main_navigation' ) ) ) {
  452. $html .= '<a href="#" class="fusion-icon fusion-icon-bars"></a>';
  453. }
  454. if ( ( 'v4' == Avada()->settings->get( 'header_layout' ) || 'Top' != Avada()->settings->get( 'header_position' ) ) && ( 'Tagline And Search' == $header_content_3 || 'Search' == $header_content_3 ) ) {
  455. $html .= '<a href="#" class="fusion-icon fusion-icon-search"></a>';
  456. }
  457. if ( class_exists('WooCommerce') && Avada()->settings->get( 'woocommerce_cart_link_main_nav' ) ) {
  458. $html .= '<a href="' . get_permalink( get_option( 'woocommerce_cart_page_id' ) ) . '" class="fusion-icon fusion-icon-shopping-cart"></a>';
  459. }
  460. $html .= '</div>';
  461. }
  462. return $html;
  463. }
  464. }
  465. if ( ! function_exists( 'avada_mobile_main_menu' ) ) {
  466. function avada_mobile_main_menu() {
  467. if ( 'Top' != Avada()->settings->get( 'header_position' ) || ( ! in_array( Avada()->settings->get( 'header_layout' ), array( 'v4', 'v5' ) ) ) ) {
  468. echo avada_modern_menu();
  469. }
  470. $mobile_menu_text_align = '';
  471. if ( 'right' == Avada()->settings->get( 'mobile_menu_text_align' ) ) {
  472. $mobile_menu_text_align = ' fusion-mobile-menu-text-align-right';
  473. }
  474. printf( '<div class="fusion-mobile-nav-holder%s"></div>', $mobile_menu_text_align );
  475. if ( has_nav_menu( 'sticky_navigation' ) ) {
  476. printf( '<div class="fusion-mobile-nav-holder%s fusion-mobile-sticky-nav-holder"></div>', $mobile_menu_text_align );
  477. }
  478. }
  479. }
  480. // Omit closing PHP tag to avoid "Headers already sent" issues.