Advertisement
cipher87

Header Meta with Cart Icon

Jul 2nd, 2019
497
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 10.08 KB | None | 0 0
  1. <?php
  2. /*
  3.  * For https://kriesi.at/support/topic/cart-icon-in-secondary-header/
  4.  */
  5. if ( ! defined( 'ABSPATH' ) ) {  exit;  }    // Exit if accessed directly
  6.  
  7.  
  8. global $avia_config;
  9.  
  10. $responsive     = avia_get_option('responsive_active') != "disabled" ? "responsive" : "fixed_layout";
  11. $headerS        = avia_header_setting();
  12. $social_args    = array('outside'=>'ul', 'inside'=>'li', 'append' => '');
  13. $icons          = !empty($headerS['header_social']) ? avia_social_media_icons($social_args, false) : "";
  14. $alternate_menu_id = ! empty( $headerS['alternate_menu'] ) && is_numeric( $headerS['alternate_menu'] ) && empty( $headerS['menu_display'] ) ? $headerS['alternate_menu'] : false;
  15.  
  16. /**
  17.  * For sidebar menus this filter allows to activate alternate menus - are disabled by default
  18.  *
  19.  * @since 4.5
  20.  * @param int|false $alternate_menu_id
  21.  * @param array $headerS
  22.  * @return int|false
  23.  */
  24. $alternate_menu_id = apply_filters( 'avf_alternate_mobile_menu_id', $alternate_menu_id, $headerS );
  25.  
  26. if( isset( $headerS['disabled'] ) )
  27. {    
  28.     return;  
  29. }
  30.  
  31. ?>
  32.  
  33. <header id='header' class='all_colors header_color <?php avia_is_dark_bg('header_color'); echo " ".$headerS['header_class']; ?>' <?php avia_markup_helper(array('context' => 'header','post_type'=>'forum'));?>>
  34.  
  35. <?php
  36. $headerS['header_topbar'] = true; //added
  37. //subheader, only display when the user chooses a social header
  38. if($headerS['header_topbar'] == true)
  39. {
  40. ?>
  41.         <div id='header_meta' class='container_wrap container_wrap_meta <?php echo avia_header_class_string(array('header_social', 'header_secondary_menu', 'header_phone_active'), 'av_'); ?>'>
  42.        
  43.                   <div class='container'>
  44.                   <?php
  45.                         /*
  46.                         *   display the themes social media icons, defined in the wordpress backend
  47.                         *   the avia_social_media_icons function is located in includes/helper-social-media-php
  48.                         */
  49.                         $nav = "";
  50.                        
  51.                         //display icons
  52.                         if(strpos( $headerS['header_social'], 'extra_header_active') !== false) echo $icons;
  53.                    
  54.                         //display navigation
  55.                         if(strpos( $headerS['header_secondary_menu'], 'extra_header_active') !== false )
  56.                         {
  57.                             //display the small submenu
  58.                             $avia_theme_location = 'avia2';
  59.                             $avia_menu_class = $avia_theme_location . '-menu';
  60.                             $args = array(
  61.                                 'theme_location'=>$avia_theme_location,
  62.                                 'menu_id' =>$avia_menu_class,
  63.                                 'container_class' =>$avia_menu_class,
  64.                                 'fallback_cb' => '',
  65.                                 'container'=>'',
  66.                                 'echo' =>false
  67.                             );
  68.                            
  69.                             $nav = wp_nav_menu($args);
  70.                         }
  71.                            
  72.                         if(!empty($nav) || apply_filters('avf_execute_avia_meta_header', false))
  73.                         {
  74.                             echo "<nav class='sub_menu' ".avia_markup_helper(array('context' => 'nav', 'echo' => false)).">";
  75.                             echo $nav;
  76.                             do_action('avia_meta_header'); // Hook that can be used for plugins and theme extensions (currently: the wpml language selector)
  77.                             echo '</nav>';
  78.                         }
  79.                        
  80.                        
  81.                         //phone/info text  
  82.                         $phone          = $headerS['header_phone_active'] != "" ? $headerS['phone'] : "";
  83.                         $phone_class    = !empty($nav) ? "with_nav" : "";
  84.                         if($phone)      { echo "<div class='phone-info {$phone_class}'><span>".do_shortcode($phone)."</span></div>"; }
  85.                            
  86.                         do_action('avia_after_phone_info'); //added
  87.                     ?>
  88.                   </div>
  89.         </div>
  90.  
  91. <?php }
  92.    
  93.    
  94.    
  95.     $output      = "";
  96.     $temp_output = "";
  97.     $icon_beside = "";
  98.    
  99.     if($headerS['header_social'] == 'icon_active_main' && empty($headerS['bottom_menu']))
  100.     {
  101.         $icon_beside = " av_menu_icon_beside";
  102.     }
  103.    
  104.    
  105.    
  106.    
  107.    
  108.    
  109. ?>
  110.         <div  id='header_main' class='container_wrap container_wrap_logo'>
  111.    
  112.         <?php
  113.         /*
  114.         * Hook that can be used for plugins and theme extensions (currently:  the woocommerce shopping cart)
  115.         */
  116.         do_action('ava_main_header');
  117.        
  118.         if($headerS['header_position'] != "header_top") do_action('ava_main_header_sidebar');
  119.        
  120.    
  121.                  $output .= "<div class='container av-logo-container'>";
  122.                  
  123.                     $output .= "<div class='inner-container'>";
  124.                        
  125.                         /*
  126.                         *   display the theme logo by checking if the default logo was overwritten in the backend.
  127.                         *   the function is located at framework/php/function-set-avia-frontend-functions.php in case you need to edit the output
  128.                         */
  129.                         $addition = false;
  130.                         if( ! empty( $headerS['header_transparency'] ) && ! empty( $headerS['header_replacement_logo'] ) )
  131.                         {
  132.                             $addition = "<img src='{$headerS['header_replacement_logo']}' class='alternate' alt='{$headerS['header_replacement_logo_alt']}' title='{$headerS['header_replacement_logo_title']}' />";
  133.                         }
  134.                        
  135.                         $output .= avia_logo(AVIA_BASE_URL.'images/layout/logo.png', $addition, 'span', true);
  136.                        
  137.                             if(!empty($headerS['bottom_menu']))
  138.                             {
  139.                                 ob_start();
  140.                                 do_action('ava_before_bottom_main_menu'); // todo: replace action with filter, might break user customizations
  141.                                 $output .= ob_get_clean();
  142.                             }
  143.                            
  144.                             if($headerS['header_social'] == 'icon_active_main' && !empty($headerS['bottom_menu']))
  145.                             {
  146.                                 $output .= $icons;
  147.                             }
  148.                            
  149.                        
  150.                         /*
  151.                         *   display the main navigation menu
  152.                         *   modify the output in your wordpress admin backend at appearance->menus
  153.                         */
  154.                            
  155.                             if($headerS['bottom_menu'])
  156.                             {
  157.                                 $output .= "</div>";  
  158.                                 $output .= "</div>";
  159.                                
  160.                                 if( !empty( $headerS['header_menu_above'] ))
  161.                                 {
  162.                                     $avia_config['temp_logo_container'] = "<div class='av-section-bottom-logo header_color'>".$output."</div>";
  163.                                     $output = "";
  164.                                 }
  165.                                
  166.                                 $output .= "<div id='header_main_alternate' class='container_wrap'>";
  167.                                 $output .= "<div class='container'>";
  168.                             }
  169.                        
  170.                             $avia_theme_location = 'avia';
  171.                             $avia_menu_class = $avia_theme_location . '-menu';
  172.        
  173.                             $main_nav = "<nav class='main_menu' data-selectname='".__('Select a page','avia_framework')."' ".avia_markup_helper(array('context' => 'nav', 'echo' => false)).">";
  174.                                
  175.                             $args = array(
  176.                                     'theme_location'    => $avia_theme_location,
  177.                                     'menu_id'           => $avia_menu_class,
  178.                                     'menu_class'        => 'menu av-main-nav',
  179.                                     'container_class'   => $avia_menu_class.' av-main-nav-wrap'.$icon_beside,
  180.                                     'fallback_cb'       => 'avia_fallback_menu',
  181.                                     'echo'              =>  false,
  182.                                     'walker'            => new avia_responsive_mega_menu()
  183.                                 );
  184.                        
  185.                                 $wp_main_nav = wp_nav_menu($args);
  186.                                 $main_nav .= $wp_main_nav;
  187.                                
  188.                              
  189.                             /*
  190.                             * Hook that can be used for plugins and theme extensions
  191.                             */
  192.                             ob_start();
  193.                             do_action('ava_inside_main_menu'); // todo: replace action with filter, might break user customizations
  194.                             $main_nav .= ob_get_clean();
  195.                            
  196.                             if($icon_beside)
  197.                             {
  198.                                 $main_nav .= $icons;
  199.                             }
  200.                                
  201.                             $main_nav .= '</nav>';
  202.                            
  203.                             /**
  204.                              * Allow to modify or remove main menu for special pages
  205.                              *
  206.                              * @since 4.1.3
  207.                              */
  208.                             $output .= apply_filters( 'avf_main_menu_nav', $main_nav );
  209.                        
  210.                             /*
  211.                             * Hook that can be used for plugins and theme extensions
  212.                             */
  213.                             ob_start();
  214.                             do_action('ava_after_main_menu'); // todo: replace action with filter, might break user customizations
  215.                             $output .= ob_get_clean();
  216.                
  217.                      /* inner-container */
  218.                     $output .= "</div>";
  219.                        
  220.                 /* end container */
  221.                 $output .= " </div> ";
  222.                
  223.                
  224.                 //output the whole menu    
  225.                 echo $output;
  226.                
  227.                
  228.            ?>
  229.  
  230.         <!-- end container_wrap-->
  231.         </div>
  232. <?php
  233.         /**
  234.          * Add a hidden container for alternate mobile menu
  235.          *
  236.          * We use the same structure as main menu to be able to use same logic in js to build burger menu
  237.          *
  238.          * @added_by Günter
  239.          * @since 4.5
  240.          */
  241.         $out_alternate = '';
  242.         $avia_alternate_location = 'avia_alternate';
  243.         $avia_alternate_menu_class = $avia_alternate_location . '_menu';
  244.        
  245.         if( false !== $alternate_menu_id && is_nav_menu( $alternate_menu_id ) )
  246.         {
  247.             $out_alternate .= '<div id="avia_alternate_menu" style="display: none;">';
  248.            
  249.             $alternate_nav =    "<nav class='main_menu' data-selectname='" . __( 'Select a page', 'avia_framework' ) . "' " . avia_markup_helper( array( 'context' => 'nav', 'echo' => false ) ) . ">";
  250.            
  251.             $args = array(
  252.                             'menu'              => $alternate_menu_id,
  253.                             'menu_id'           => $avia_alternate_menu_class,
  254.                             'menu_class'        => 'menu av-main-nav',
  255.                             'container_class'   => $avia_alternate_menu_class.' av-main-nav-wrap',
  256.                             'fallback_cb'       => 'avia_fallback_menu',
  257.                             'echo'              => false,
  258.                             'walker'            => new avia_responsive_mega_menu()
  259.                         );
  260.  
  261.             $wp_nav_alternate = wp_nav_menu( $args );
  262.            
  263.             /**
  264.              * Hook that can be used for plugins and theme extensions
  265.              *
  266.              * @since 4.5
  267.              * @return string
  268.              */
  269.             $alternate_nav .=       apply_filters( 'avf_inside_alternate_main_menu_nav', $wp_nav_alternate, $avia_alternate_location, $avia_alternate_menu_class );
  270.            
  271.             $alternate_nav .=   '</nav>';
  272.  
  273.             /**
  274.              * Allow to modify or remove alternate menu for special pages.
  275.              *
  276.              * @since 4.5
  277.              * @return string
  278.              */
  279.             $out_alternate .= apply_filters( 'avf_alternate_main_menu_nav', $alternate_nav );
  280.  
  281.             $out_alternate .= '</div>';
  282.         }
  283.        
  284.         /**
  285.          * Hook to remove or modify alternate mobile menu
  286.          *
  287.          * @since 4.5
  288.          * @return string
  289.          */
  290.         $out_alternate = apply_filters( 'avf_alternate_mobile_menu', $out_alternate );
  291.        
  292.         if( ! empty ( $out_alternate ) )
  293.         {
  294.             echo $out_alternate;
  295.         }
  296. ?>
  297.         <div class='header_bg'></div>
  298.  
  299. <!-- end header -->
  300. </header>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement