Advertisement
artemsemkin

Cassio Theme Burger Customization

Dec 8th, 2020
388
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 11.45 KB | None | 0 0
  1. <?php
  2.  
  3. $arts_has_menu                     = has_nav_menu( 'main_menu' );
  4. $arts_menu_style                   = get_theme_mod( 'menu_style', 'classic' );
  5. $arts_page_header_settings         = arts_get_document_option( 'page_header_settings' );
  6. $arts_class_burger_col             = '';
  7. $arts_enable_ajax                  = get_theme_mod( 'enable_ajax', false );
  8. $arts_is_elementor_canvas_template = arts_get_document_option( 'template' ) === 'elementor_canvas';
  9.  
  10. /**
  11.  * Use Individual Page Header Settings from Elementor
  12.  * Or Use Global Settings from Customizer
  13.  */
  14. if ( $arts_page_header_settings ) {
  15.   $arts_class_header               = arts_get_document_option( 'page_header_main_theme' );
  16.   $arts_class_sticky_header        = arts_get_document_option( 'page_header_sticky_theme' );
  17.   $arts_class_overlay_menu_wrapper = arts_get_document_option( 'page_header_overlay_menu_theme' );
  18.   $arts_attrs_header_logo          = arts_get_document_option( 'page_header_main_logo' );
  19.   $arts_attrs_header_sticky_logo   = arts_get_document_option( 'page_header_sticky_logo' );
  20. } else {
  21.   $arts_class_header               = get_theme_mod( 'header_main_theme', 'header_color-black' );
  22.   $arts_class_sticky_header        = get_theme_mod( 'header_sticky_theme', 'bg-dark-2' );
  23.   $arts_class_overlay_menu_wrapper = get_theme_mod( 'header_overlay_menu_theme', 'bg-dark' );
  24.   $arts_attrs_header_logo          = get_theme_mod( 'header_main_logo', 'header_logo-primary' );
  25.   $arts_attrs_header_sticky_logo   = get_theme_mod( 'header_sticky_logo', 'header_logo-secondary' );
  26. }
  27.  
  28. $arts_class_curtain          = '';
  29. $arts_header_type            = get_theme_mod( 'header_type', 'sticky' );
  30. $arts_header_container_class = get_theme_mod( 'header_container', 'container-fluid' );
  31. $arts_menu_style             = get_theme_mod( 'menu_style', 'classic' );
  32.  
  33. $arts_social_links = get_theme_mod( 'social_links', null );
  34.  
  35. $arts_enable_morphing_letters      = get_theme_mod( 'enable_morphing_letters', true );
  36. $arts_morphing_letters_set         = get_theme_mod( 'morphing_letters_set', array( 'latin' ) );
  37. $arts_menu_overlay_circle_contents = get_theme_mod( 'menu_overlay_circle_contents', 'letters' );
  38.  
  39. $arts_menu_overlay_background     = get_theme_mod( 'menu_overlay_background', 'ornament' );
  40. $arts_menu_overlay_background_url = get_theme_mod( 'menu_overlay_background_url' );
  41. $arts_menu_overlay_background_id  = '';
  42. $arts_menu_overlay_info           = get_theme_mod( 'menu_overlay_info' );
  43. $arts_menu_overlay_info_length    = 0;
  44. $arts_menu_overlay_info_class_col;
  45. $arts_menu_overlay_info_classes_alignment = [];
  46. $arts_enable_master_audio_background      = get_theme_mod( 'enable_master_audio_background', false );
  47. $arts_master_audio_player_position        = get_theme_mod( 'master_audio_player_position', 'header' );
  48.  
  49. $arts_header_has_lang_switcher = is_active_sidebar( 'lang-switcher-sidebar' ) && ( class_exists( 'SitePress' ) || class_exists( 'Polylang' ) || class_exists( 'TRP_Translate_Press' ) );
  50. $arts_class_col_right          = $arts_header_has_lang_switcher ? '' : 'd-none d-lg-block';
  51.  
  52. if ( ( $arts_menu_overlay_background === 'custom' && ! empty( $arts_menu_overlay_background_url ) ) ) {
  53.   $arts_menu_overlay_background_id = attachment_url_to_postid( $arts_menu_overlay_background_url );
  54. }
  55.  
  56. if ( is_array( $arts_menu_overlay_info ) ) {
  57.   $arts_menu_overlay_info_length = count( $arts_menu_overlay_info );
  58. }
  59.  
  60. if ( $arts_header_type === 'sticky' ) {
  61.   $arts_class_header .= ' header_fixed';
  62.   $arts_class_header .= ' js-sticky-header';
  63. }
  64.  
  65. if ( $arts_header_type === 'absolute' ) {
  66.   $arts_class_header .= ' header_absolute';
  67. }
  68.  
  69. if ( $arts_menu_style === 'classic' ) {
  70.   $arts_class_burger_col = 'd-lg-none';
  71. }
  72.  
  73. if ( $arts_menu_style === 'fullscreen' && ! $arts_enable_morphing_letters ) {
  74.   $arts_class_overlay_menu_wrapper .= ' text-center justify-content-center';
  75. }
  76.  
  77. if ( $arts_menu_overlay_background === 'ornament' ) {
  78.   $arts_class_curtain .= ' bg-ornament';
  79. }
  80.  
  81. switch ( $arts_menu_overlay_info_length ) {
  82.   case 3:
  83.     $arts_menu_overlay_info_class_col         = 'col-lg-4';
  84.     $arts_menu_overlay_info_classes_alignment = [ 'text-left', 'text-center', 'text-right' ];
  85.     break;
  86.   case 2:
  87.     $arts_menu_overlay_info_class_col         = 'col-lg-6';
  88.     $arts_menu_overlay_info_classes_alignment = [ 'text-left', 'text-right', '' ];
  89.     break;
  90.   default:
  91.     $arts_menu_overlay_info_class_col = 'col';
  92.     if ( $arts_enable_morphing_letters ) {
  93.       $arts_menu_overlay_info_classes_alignment = [ 'text-left', '', '' ];
  94.     } else {
  95.       $arts_menu_overlay_info_classes_alignment = [ 'text-center', '', '' ];
  96.     }
  97.     break;
  98. }
  99.  
  100. if ( $arts_enable_ajax && $arts_is_elementor_canvas_template ) {
  101.   $arts_class_header .= ' hidden';
  102. }
  103.  
  104. ?>
  105.  
  106. <header id="page-header" class="header <?php echo esc_attr( $arts_class_header ); ?>" data-header-animation="" data-header-sticky-theme="<?php echo esc_attr( $arts_class_sticky_header ); ?>" data-header-sticky-logo="<?php echo esc_attr( $arts_attrs_header_sticky_logo ); ?>" data-header-logo="<?php echo esc_attr( $arts_attrs_header_logo ); ?>">
  107.   <div class="<?php echo esc_attr( $arts_header_container_class ); ?> header__controls header__container">
  108.   <div class="row justify-content-between align-items-center">
  109.     <div class="col text-left header__col-left">
  110.     <?php get_template_part( 'template-parts/logo/logo' ); ?>
  111.     </div>
  112.     <?php if ( $arts_has_menu && $arts_menu_style === 'classic' ) : ?>
  113.     <div class="col-auto text-center d-none d-lg-block">
  114.       <?php
  115.       wp_nav_menu(
  116.         array(
  117.           'theme_location' => 'main_menu',
  118.           'container'      => false,
  119.         )
  120.       );
  121.       ?>
  122.     </div>
  123.     <?php endif; ?>
  124.     <?php if ( $arts_has_menu ) : ?>
  125.     <div class="col-auto text-center <?php echo esc_attr( $arts_class_burger_col ); ?>">
  126.       <div class="header__burger" id="js-burger">
  127.         <a style="white-space: nowrap; font-weight: bold; pointer-events: none;" href="#"><?php echo esc_html__( 'Menu', 'cassio' ); ?></span>
  128.       </div>
  129.     </div>
  130.     <?php endif; ?>
  131.     <?php if ( $arts_social_links || $arts_header_has_lang_switcher || $arts_enable_master_audio_background ) : ?>
  132.     <div class="col text-right header__col-right <?php echo esc_attr( $arts_class_col_right ); ?>">
  133.       <div class="row justify-content-end align-items-center">
  134.       <?php if ( $arts_enable_master_audio_background && $arts_master_audio_player_position == 'header' ) : ?>
  135.         <!-- Audio Control -->
  136.         <div class="col-auto d-none d-lg-block">
  137.         <?php get_template_part( 'template-parts/audio/control' ); ?>
  138.         </div>
  139.         <!-- - Audio Control -->
  140.       <?php endif; ?>
  141.       <?php if ( $arts_social_links ) : ?>
  142.         <div class="col-auto d-none d-lg-block">
  143.         <ul class="social">
  144.           <?php foreach ( $arts_social_links as $item ) : ?>
  145.           <li class="social__item">
  146.             <a class="social__icon <?php echo esc_attr( $item['social_icon'] ); ?>" href="<?php echo esc_url( $item['social_url'] ); ?>" target="_blank"></a>
  147.           </li>
  148.           <?php endforeach; ?>
  149.         </ul>
  150.         </div>
  151.       <?php endif; ?>
  152.       <?php if ( $arts_header_has_lang_switcher ) : ?>
  153.         <div class="col-auto">
  154.         <div class="lang-switcher">
  155.           <?php dynamic_sidebar( 'lang-switcher-sidebar' ); ?>
  156.         </div>
  157.         </div>
  158.       <?php endif; ?>
  159.       </div>
  160.     </div>
  161.     <?php endif; ?>
  162.   </div>
  163.   <?php if ( $arts_has_menu ) : ?>
  164.     <div class="header__overlay-menu-back material-icons" id="js-submenu-back">arrow_back</div>
  165.     <!-- - back button -->
  166.   <?php endif; ?>
  167.   </div>
  168.   <div class="header__wrapper-overlay-menu container-fluid <?php echo esc_attr( $arts_class_overlay_menu_wrapper ); ?>">
  169.   <!-- menu overlay -->
  170.   <div class="header__wrapper-menu">
  171.     <?php
  172.     wp_nav_menu(
  173.       array(
  174.         'theme_location' => 'main_menu',
  175.         'container'      => false,
  176.         'menu_class'     => 'menu-overlay js-menu-overlay',
  177.         'link_before'    => '<div class="menu-overlay__item-wrapper js-text-to-fly split-text js-split-text" data-split-text-type="lines, words, chars">',
  178.         'link_after'     => '</div>',
  179.         'walker'         => new Arts_Walker_Nav_Menu_Overlay(),
  180.       )
  181.     );
  182.     ?>
  183.   </div>
  184.   <!-- - menu overlay -->
  185.   <?php if ( $arts_menu_overlay_info || $arts_social_links ) : ?>
  186.     <!-- information -->
  187.     <div class="header__wrapper-overlay-widgets">
  188.     <div class="container-fluid">
  189.       <div class="row justify-content-between">
  190.       <?php if ( $arts_enable_master_audio_background && $arts_master_audio_player_position == 'header' ) : ?>
  191.         <!-- Audio Control -->
  192.         <div class="col d-lg-none">
  193.         <div class="audio-control-wrapper">
  194.           <?php get_template_part( 'template-parts/audio/control' ); ?>
  195.         </div>
  196.         </div>
  197.         <!-- - Audio Control -->
  198.       <?php endif; ?>
  199.       <?php if ( $arts_social_links ) : ?>
  200.         <div class="col-lg-4 text-center d-lg-none">
  201.         <ul class="social">
  202.           <?php foreach ( $arts_social_links as $item ) : ?>
  203.           <li class="social__item">
  204.             <a class="social__icon <?php echo esc_attr( $item['social_icon'] ); ?>" href="<?php echo esc_url( $item['social_url'] ); ?>" target="_blank"></a>
  205.           </li>
  206.           <?php endforeach; ?>
  207.         </ul>
  208.         </div>
  209.       <?php endif; ?>
  210.       <?php if ( $arts_menu_overlay_info ) : ?>
  211.         <?php foreach ( $arts_menu_overlay_info as $index => $item ) : ?>
  212.         <div class="header__widget <?php echo esc_attr( $arts_menu_overlay_info_class_col ); ?> <?php echo esc_attr( $arts_menu_overlay_info_classes_alignment[ $index ] ); ?>">
  213.           <div class="split-text js-split-text" data-split-text-type="lines" data-split-text-set="lines">
  214.           <?php echo wp_kses( $item['column'], wp_kses_allowed_html( 'post' ) ); ?>
  215.           </div>
  216.         </div>
  217.         <?php endforeach; ?>
  218.       <?php endif; ?>
  219.       </div>
  220.     </div>
  221.     </div>
  222.     <!-- - information -->
  223.   <?php endif; ?>
  224.   <?php if ( $arts_menu_style === 'fullscreen' && $arts_enable_morphing_letters && ! empty( $arts_morphing_letters_set ) ) : ?>
  225.     <!-- letters -->
  226.     <div class="header__circle-letters">
  227.       <?php if ( $arts_menu_overlay_circle_contents === 'letters' ) : ?>
  228.         <svg class="vector-letters" width="158px" height="158px" viewBox="0 0 158 158" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
  229.           <?php foreach ( $arts_morphing_letters_set as $set ) : ?>
  230.             <?php get_template_part( 'template-parts/svg/path/letters', esc_attr( $set ) ); ?>
  231.           <?php endforeach; ?>
  232.         </svg>
  233.       <?php endif; ?>
  234.       <?php if ( $arts_menu_overlay_circle_contents === 'logo' ) : ?>
  235.         <?php get_template_part( 'template-parts/logo/logo' ); ?>
  236.       <?php endif; ?>
  237.       <?php get_template_part( 'template-parts/svg/circle' ); ?>
  238.     </div>
  239.     <!-- - letters -->
  240.   <?php endif; ?>
  241.   <!-- background -->
  242.   <?php if ( $arts_menu_overlay_background === 'custom' && ! empty( $arts_menu_overlay_background_id ) ) : ?>
  243.     <?php
  244.     arts_the_lazy_image(
  245.       array(
  246.         'id'    => $arts_menu_overlay_background_id,
  247.         'class' => array(
  248.           'image' => array( 'header__curtain', $arts_class_curtain ),
  249.         ),
  250.       )
  251.     );
  252.     ?>
  253.   <?php else : ?>
  254.     <div class="header__curtain <?php echo esc_attr( $arts_class_curtain ); ?>"></div>
  255.   <?php endif; ?>
  256.   <!-- - background -->
  257.   </div>
  258. </header>
  259.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement