has_header() ) {
get_template_part( 'template-parts/header/base' );
}
}
/**
* Header Top Row
*/
function top_header() {
if ( kadence()->display_header_row( 'top' ) ) {
kadence()->get_template( 'template-parts/header/header', 'row', array( 'row' => 'top' ) );
}
}
/**
* Header Main Row
*/
function main_header() {
if ( kadence()->display_header_row( 'main' ) ) {
kadence()->get_template( 'template-parts/header/header', 'row', array( 'row' => 'main' ) );
}
}
/**
* Header Bottom Row
*/
function bottom_header() {
if ( kadence()->display_header_row( 'bottom' ) ) {
kadence()->get_template( 'template-parts/header/header', 'row', array( 'row' => 'bottom' ) );
}
}
/**
* Header Column
*
* @param string $row the column row.
* @param string $column the row column.
*/
function header_column( $row, $column ) {
kadence()->render_header( $row, $column );
}
/**
* Mobile Header
*/
function mobile_header() {
get_template_part( 'template-parts/header/mobile' );
}
/**
* Mobile Header Top Row
*/
function mobile_top_header() {
if ( kadence()->display_mobile_header_row( 'top' ) ) {
kadence()->get_template( 'template-parts/header/mobile-header', 'row', array( 'mobile_row' => 'top' ) );
}
}
/**
* Mobile Header Main Row
*/
function mobile_main_header() {
if ( kadence()->display_mobile_header_row( 'main' ) ) {
kadence()->get_template( 'template-parts/header/mobile-header', 'row', array( 'mobile_row' => 'main' ) );
}
}
/**
* Mobile Header Bottom Row
*/
function mobile_bottom_header() {
if ( kadence()->display_mobile_header_row( 'bottom' ) ) {
kadence()->get_template( 'template-parts/header/mobile-header', 'row', array( 'mobile_row' => 'bottom' ) );
}
}
/**
* Mobile Header Column
*
* @param string $row the header row.
* @param string $column the row column.
*/
function mobile_header_column( $row, $column ) {
kadence()->render_header( $row, $column, 'mobile' );
}
/**
* Header Row Class.
*
* @param string $row the header row.
*/
function header_row_class( $row ) {
$classes = 'site-' . esc_attr( $row ) . '-header-wrap site-header-row-container site-header-focus-item site-header-row-layout-' . esc_attr( kadence()->sub_option( 'header_' . $row . '_layout', 'desktop' ) ) . esc_attr( kadence()->option( 'header_sticky' ) === $row ? ' kadence-sticky-header' : '' );
return apply_filters( 'kadence-header-row-class-string', $classes );
}
/**
* Desktop Site Branding
*/
function site_branding() {
$layout = kadence()->option( 'logo_layout' );
$includes = array();
$layouts = array();
if ( is_array( $layout ) && isset( $layout['include'] ) ) {
if ( isset( $layout['layout'] ) ) {
if ( isset( $layout['layout']['desktop'] ) && ! empty( $layout['layout']['desktop'] ) ) {
$layouts['desktop'] = $layout['layout']['desktop'];
}
}
if ( isset( $layout['include']['desktop'] ) && ! empty( $layout['include']['desktop'] ) ) {
if ( strpos( $layout['include']['desktop'], 'logo' ) !== false ) {
if ( ! in_array( 'logo', $includes, true ) ) {
$includes[] = 'logo';
}
}
if ( strpos( $layout['include']['desktop'], 'title' ) !== false ) {
if ( ! in_array( 'title', $includes, true ) ) {
$includes[] = 'title';
}
}
if ( strpos( $layout['include']['desktop'], 'tagline' ) !== false ) {
if ( ! in_array( 'tagline', $includes, true ) ) {
$includes[] = 'tagline';
}
}
}
}
$layout_slug = isset( $layouts['desktop'] ) ? $layouts['desktop'] : 'standard';
if ( 'title_logo' === $layout_slug || 'title_tag_logo' === $layout_slug ) {
$layout_class = 'standard-reverse';
} elseif ( 'top_logo_title' === $layout_slug || 'top_logo_title_tag' === $layout_slug ) {
$layout_class = 'vertical';
} elseif ( 'top_title_logo' === $layout_slug || 'top_title_tag_logo' === $layout_slug ) {
$layout_class = 'vertical-reverse';
} elseif ( 'top_title_logo_tag' === $layout_slug ) {
$layout_class = 'vertical site-title-top';
} elseif ( 'standard' === $layout_slug && ! in_array( 'title', $includes, true ) ) {
$layout_class = 'standard site-brand-logo-only';
} else {
$layout_class = 'standard';
}
echo '
';
}
/**
* Logo Icon Render
*/
function logo_icon() {
echo '';
$icon = kadence()->option( 'logo_icon' );
if ( 'custom' === $icon ) {
echo kadence()->option( 'logo_icon_custom' ); /* phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped */
} else {
kadence()->print_icon( $icon, '', false );
}
echo '';
}
/**
* Desktop Navigation
*/
function primary_navigation() {
?>
option( $option_string );
// We have a logo. Logo is go.
if ( $custom_logo_id ) {
$custom_logo_attr = array(
'class' => 'custom-logo ' . $custom_class,
'loading' => false,
);
/*
* If the logo alt attribute is empty, get the site title and explicitly
* pass it to the attributes used by wp_get_attachment_image().
*/
$image_alt = get_post_meta( $custom_logo_id, '_wp_attachment_image_alt', true );
if ( empty( $image_alt ) ) {
$custom_logo_attr['alt'] = get_bloginfo( 'name', 'display' );
}
$type = get_post_mime_type( $custom_logo_id );
if ( isset( $type ) && 'image/svg+xml' === $type ) {
$custom_logo_attr['class'] = 'custom-logo ' . $custom_class . ' svg-logo-image';
}
/*
* If the alt attribute is not empty, there's no need to explicitly pass
* it because wp_get_attachment_image() already adds the alt attribute.
*/
$html = wp_get_attachment_image( $custom_logo_id, 'full', false, $custom_logo_attr );
} elseif ( is_customize_preview() ) {
// If no logo is set but we're in the Customizer, leave a placeholder (needed for the live preview).
$html = '
';
}
/**
* Filters the custom logo output.
*
* @param string $html Custom logo HTML output.
* @param string $option_string the ID of the logo option.
*/
echo apply_filters( 'kadence_extra_custom_logo', $html, $option_string ); /* phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped */
}
/**
* Output custom logo
*
* @param integer $blog_id the site ID for multisites.
*/
function custom_logo( $blog_id = 0 ) {
$html = '';
$switched_blog = false;
if ( is_multisite() && ! empty( $blog_id ) && get_current_blog_id() !== (int) $blog_id ) {
switch_to_blog( $blog_id );
$switched_blog = true;
}
$custom_logo_id = kadence()->option( 'custom_logo' );
// We have a logo. Logo is go.
if ( $custom_logo_id ) {
$custom_logo_attr = array(
'class' => 'custom-logo',
'loading' => false,
);
/*
* If the logo alt attribute is empty, get the site title and explicitly
* pass it to the attributes used by wp_get_attachment_image().
*/
$image_alt = get_post_meta( $custom_logo_id, '_wp_attachment_image_alt', true );
if ( empty( $image_alt ) ) {
$custom_logo_attr['alt'] = get_bloginfo( 'name', 'display' );
}
$type = get_post_mime_type( $custom_logo_id );
if ( isset( $type ) && 'image/svg+xml' === $type ) {
$custom_logo_attr['class'] = 'custom-logo svg-logo-image';
}
/*
* If the alt attribute is not empty, there's no need to explicitly pass
* it because wp_get_attachment_image() already adds the alt attribute.
*/
$html = wp_get_attachment_image( $custom_logo_id, 'full', false, $custom_logo_attr );
} elseif ( is_customize_preview() ) {
// If no logo is set but we're in the Customizer, leave a placeholder (needed for the live preview).
$html = '
';
}
if ( $switched_blog ) {
restore_current_blog();
}
/**
* Filters the custom logo output.
*
* @since 4.5.0
* @since 4.6.0 Added the `$blog_id` parameter.
*
* @param string $html Custom logo HTML output.
* @param int $blog_id ID of the blog to get the custom logo for.
*/
echo apply_filters( 'kadence_custom_logo', $html, $blog_id ); /* phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped */
}
/**
* Mobile Site Branding
*/
function mobile_site_branding() {
$layout = kadence()->option( 'logo_layout' );
$includes = array();
$layouts = array();
if ( is_array( $layout ) && isset( $layout['include'] ) ) {
foreach ( array( 'mobile', 'tablet', 'desktop' ) as $device ) {
if ( isset( $layout['layout'] ) ) {
if ( isset( $layout['layout'][ $device ] ) && ! empty( $layout['layout'][ $device ] ) ) {
$layouts[ $device ] = $layout['layout'][ $device ];
}
}
// if ( 'desktop' === $device && ! empty( $includes ) ) {
// continue;
// }
if ( isset( $layout['include'][ $device ] ) && ! empty( $layout['include'][ $device ] ) ) {
if ( strpos( $layout['include'][ $device ], 'logo' ) !== false ) {
if ( ! in_array( 'logo', $includes, true ) ) {
$includes[] = 'logo';
}
}
if ( strpos( $layout['include'][ $device ], 'title' ) !== false ) {
if ( ! in_array( 'title', $includes, true ) ) {
$includes[] = 'title';
}
}
if ( strpos( $layout['include'][ $device ], 'tagline' ) !== false ) {
if ( ! in_array( 'tagline', $includes, true ) ) {
$includes[] = 'tagline';
}
}
}
}
}
if ( isset( $layouts['tablet'] ) ) {
if ( 'title_logo' === $layouts['tablet'] || 'title_tag_logo' === $layouts['tablet'] ) {
$tab_layout_class = 'standard-reverse';
} elseif ( 'top_logo_title' === $layouts['tablet'] || 'top_logo_title_tag' === $layouts['tablet'] ) {
$tab_layout_class = 'vertical';
} elseif ( 'top_title_logo' === $layouts['tablet'] || 'top_title_tag_logo' === $layouts['tablet'] ) {
$tab_layout_class = 'vertical-reverse';
} elseif ( 'top_title_logo_tag' === $layouts['tablet'] ) {
$tab_layout_class = 'vertical site-title-top';
} elseif ( 'standard' === $layouts['tablet'] && ! in_array( 'title', $includes, true ) ) {
$tab_layout_class = 'standard site-brand-logo-only';
} elseif ( 'standard' === $layouts['tablet'] ) {
$tab_layout_class = 'standard';
} else {
if ( ! in_array( 'title', $includes, true ) ) {
$tab_layout_class = 'inherit site-brand-logo-only';
} else {
$tab_layout_class = 'inherit';
}
}
} else {
if ( ! in_array( 'title', $includes, true ) ) {
$tab_layout_class = 'inherit site-brand-logo-only';
} else {
$tab_layout_class = 'inherit';
}
}
if ( isset( $layouts['mobile'] ) ) {
if ( 'title_logo' === $layouts['mobile'] || 'title_tag_logo' === $layouts['mobile'] ) {
$mobile_layout_class = 'standard-reverse';
} elseif ( 'top_logo_title' === $layouts['mobile'] || 'top_logo_title_tag' === $layouts['mobile'] ) {
$mobile_layout_class = 'vertical';
} elseif ( 'top_title_logo' === $layouts['mobile'] || 'top_title_tag_logo' === $layouts['mobile'] ) {
$mobile_layout_class = 'vertical-reverse';
} elseif ( 'top_title_logo_tag' === $layouts['mobile'] ) {
$mobile_layout_class = 'vertical site-title-top';
} elseif ( 'standard' === $layouts['mobile'] && ! in_array( 'title', $includes, true ) ) {
$mobile_layout_class = 'standard site-brand-logo-only';
} elseif ( 'standard' === $layouts['mobile'] ) {
$mobile_layout_class = 'standard';
} else {
$mobile_layout_class = 'inherit';
}
} else {
$mobile_layout_class = 'inherit';
}
$has_mobile_tagline_and_logo = in_array( 'tagline', $includes, true ) && ( ! isset( $layouts['mobile'] ) || ( isset( $layouts['mobile'] ) && 'top_title_logo_tag' !== $layouts['mobile'] ) );
echo '';
}
/**
* Mobile Navigation Popup Toggle
*/
function navigation_popup_toggle() {
add_action( 'wp_footer', 'Kadence\navigation_popup' );
?>
customizer_quick_link(); ?>
is_amp() ) {
?>
option( 'mobile_trigger_icon' );
kadence()->print_icon( $icon, '', false );
}
/**
* Mobile Navigation Popup Toggle
*/
function navigation_popup() {
?>
option( 'header_html_content' );
if ( $content || is_customize_preview() ) {
$link_style = kadence()->option( 'header_html_link_style' );
$wpautop = kadence()->option( 'header_html_wpautop' );
echo '';
}
}
/**
* Mobile HTML
*/
function mobile_html() {
$content = kadence()->option( 'mobile_html_content' );
if ( $content || is_customize_preview() ) {
$link_style = kadence()->option( 'mobile_html_link_style' );
$wpautop = kadence()->option( 'mobile_html_wpautop' );
echo '';
kadence()->customizer_quick_link();
echo '
';
if ( $wpautop ) {
echo do_shortcode( wpautop( $content ) );
} else {
echo do_shortcode( $content );
}
echo '
';
echo '
';
}
}
/**
* Desktop Button
*/
function header_button() {
$label = kadence()->option( 'header_button_label' );
if ( 'loggedin' === kadence()->option( 'header_button_visibility' ) && ! is_user_logged_in() ) {
return;
}
if ( 'loggedout' === kadence()->option( 'header_button_visibility' ) && is_user_logged_in() ) {
return;
}
if ( $label || is_customize_preview() ) {
$wrap_classes = array();
$wrap_classes[] = 'header-button-wrap';
if ( 'loggedin' === kadence()->option( 'header_button_visibility' ) ) {
$wrap_classes[] = 'vs-logged-out-false';
}
if ( 'loggedout' === kadence()->option( 'header_button_visibility' ) ) {
$wrap_classes[] = 'vs-logged-in-false';
}
echo '';
kadence()->customizer_quick_link();
echo '';
echo '
';
}
}
/**
* Mobile Button
*/
function mobile_button() {
$label = kadence()->option( 'mobile_button_label' );
if ( 'loggedin' === kadence()->option( 'mobile_button_visibility' ) && ! is_user_logged_in() ) {
return;
}
if ( 'loggedout' === kadence()->option( 'mobile_button_visibility' ) && is_user_logged_in() ) {
return;
}
if ( $label || is_customize_preview() ) {
$wrap_classes = array();
$wrap_classes[] = 'mobile-header-button-wrap';
if ( 'loggedin' === kadence()->option( 'mobile_button_visibility' ) ) {
$wrap_classes[] = 'vs-logged-out-false';
}
if ( 'loggedout' === kadence()->option( 'mobile_button_visibility' ) ) {
$wrap_classes[] = 'vs-logged-in-false';
}
echo '';
kadence()->customizer_quick_link();
$rel = array();
if ( kadence()->option( 'mobile_button_target' ) ) {
$rel[] = 'noopener';
$rel[] = 'noreferrer';
}
if ( kadence()->option( 'mobile_button_nofollow' ) ) {
$rel[] = 'nofollow';
}
if ( kadence()->option( 'mobile_button_sponsored' ) ) {
$rel[] = 'sponsored';
}
$classes = array();
$classes[] = 'button';
$classes[] = 'mobile-header-button';
$classes[] = 'button-size-' . esc_attr( kadence()->option( 'mobile_button_size' ) );
$classes[] = 'button-style-' . esc_attr( kadence()->option( 'mobile_button_style' ) );
echo '';
echo '
';
}
}
/**
* Desktop Cart
*/
function header_cart() {
if ( class_exists( 'woocommerce' ) ) {
wp_enqueue_script( 'wc-cart-fragments' );
$label = kadence()->option( 'header_cart_label' );
$show_total = kadence()->option( 'header_cart_show_total' );
$icon = kadence()->option( 'header_cart_icon', 'shopping-bag' );
$dropdown = 'header-navigation nav--toggle-sub header-navigation-dropdown-animation-' . esc_attr( kadence()->option( 'dropdown_navigation_reveal' ) );
echo '';
}
}
/**
* Cart Popup Toggle
*/
function cart_popup() {
?>
jQuery( document.body ).on( 'removed_from_cart', function() {jQuery(document.body).trigger('update_checkout'); });";
}
}
/**
* Desktop Cart
*/
function mobile_cart() {
if ( class_exists( 'woocommerce' ) ) {
wp_enqueue_script( 'wc-cart-fragments' );
$label = kadence()->option( 'header_mobile_cart_label' );
$show_total = kadence()->option( 'header_mobile_cart_show_total' );
$icon = kadence()->option( 'header_mobile_cart_icon', 'shopping-bag' );
echo '';
}
}
/**
* Desktop Social
*/
function header_social() {
$items = kadence()->sub_option( 'header_social_items', 'items' );
$show_label = kadence()->option( 'header_social_show_label' );
$brand_colors = kadence()->option( 'header_social_brand' );
$brand_color_class = '';
if ( 'onhover' === $brand_colors ) {
$brand_color_class = ' social-show-brand-hover';
} elseif ( 'untilhover' === $brand_colors ) {
$brand_color_class = ' social-show-brand-until';
} elseif ( 'always' === $brand_colors ) {
$brand_color_class = ' social-show-brand-always';
}
echo '';
}
/**
* Mobile Social
*/
function mobile_social() {
$items = kadence()->sub_option( 'header_mobile_social_items', 'items' );
$show_label = kadence()->option( 'header_mobile_social_show_label' );
$brand_colors = kadence()->option( 'header_mobile_social_brand' );
$brand_color_class = '';
if ( 'onhover' === $brand_colors ) {
$brand_color_class = ' social-show-brand-hover';
} elseif ( 'untilhover' === $brand_colors ) {
$brand_color_class = ' social-show-brand-until';
} elseif ( 'always' === $brand_colors ) {
$brand_color_class = ' social-show-brand-always';
}
echo '';
}
/**
* Header Search Popup Toggle
*/
function header_search() {
add_action( 'wp_footer', 'Kadence\search_modal', 20 );
?>
customizer_quick_link(); ?>
is_amp() ) {
?>
option( 'header_search_icon' );
kadence()->print_icon( $icon, '', false );
}
/**
* Search Popup Modal
*/
function search_modal() {
?>