/** * Recursive wp_parse_args WordPress function which handles multidimensional arrays * @url http://mekshq.com/recursive-wp-parse-args-wordpress-function/ * @param array &$a Args * @param array $b Defaults */ function zn_wp_parse_args(&$a, $b) { $a = (array) $a; $b = (array) $b; $result = $b; foreach ($a as $k => &$v) { if (is_array($v) && isset($result[$k])) { $result[$k] = zn_wp_parse_args($v, $result[$k]); } else { $result[$k] = $v; } } return $result; }
<?php /** * Display Header's HTML markup */ $inner = array('left' => array('alignment_x' => 'fxb-start-x', 'alignment_y' => 'fxb-center-y', 'stretch' => 'fxb-basis-auto'), 'center' => array('alignment_x' => 'fxb-center-x', 'alignment_y' => 'fxb-center-y', 'stretch' => 'fxb-basis-auto'), 'right' => array('alignment_x' => 'fxb-end-x', 'alignment_y' => 'fxb-center-y', 'stretch' => 'fxb-basis-auto')); $flexbox_scheme_defaults = array('top' => $inner, 'main' => $inner, 'bottom' => $inner); // Extend Flexbox scheme defaults $flexbox_scheme = zn_wp_parse_args($flexbox_scheme, $flexbox_scheme_defaults); // START MARKUP // place a hook before markup do_action('zn_before_siteheader_inside'); // Area checks - TOP $check_top = has_action('zn_head__top_left') || has_action('zn_head_left_area') || has_action('zn_head_left_area_s7') || has_action('zn_head_left_area_s9') || has_action('zn_head__top_right') || has_action('zn_head_right_area') || has_action('zn_head_right_area_s7') || has_action('zn_head_right_area_s9'); // Area checks - BOTTOM $check_bottom = has_action('zn_head__bottom_left') || has_action('zn_head__bottom_center') || has_action('zn_head__bottom_right') || has_action('zn_head_cart_area_s8') || has_action('zn_head__before__bottom') || has_action('zn_head__after__bottom'); // Add Classes to Main if no Top/Bottom $main_class = ''; $main_class .= !$check_top ? ' header-no-top' : ''; $main_class .= !$check_bottom ? ' header-no-bottom' : ''; ?> <div class="site-header-wrapper <?php echo $sticky_class ? $sticky_class : ''; ?> "> <div class="kl-top-header site-header-main-wrapper clearfix"> <div class="container siteheader-container <?php echo $siteheader_container_class ? $siteheader_container_class : ''; ?>