post_type) && in_array($post->post_type, $blog_post_type_list) && is_single()) ? true : false; if (empty($bg_position)) { $bg_position = 'top'; } if (empty($bg_type)) { $bg_type = 'image_bg'; } // Theme option: Automatically Add Page Title to Page Header. $pages_to_skip = apply_filters('nectar_auto_page_header_bypass', array()); if (is_array($pages_to_skip)) { foreach ($pages_to_skip as $page) { if (is_page($page)) { $header_auto_title = false; } } } if ($header_auto_title && is_page() && empty($title)) { $title = esc_html(get_the_title()); $auto_header_bg_color = (isset($nectar_options['header-auto-title-bg-color']) && !empty($nectar_options['header-auto-title-bg-color'])) ? esc_html($nectar_options['header-auto-title-bg-color']) : false; $auto_header_featured_img = (isset($nectar_options['header-auto-title-use-featured-img']) && '1' === $nectar_options['header-auto-title-use-featured-img']) ? true : false; $auto_header_overlay_color = (isset($nectar_options['header-auto-title-overlay-color']) && !empty($nectar_options['header-auto-title-overlay-color'])) ? esc_html($nectar_options['header-auto-title-overlay-color']) : false; $auto_header_overlay_opacity = (isset($nectar_options['header-auto-title-overlay-opacity']) && !empty($nectar_options['header-auto-title-overlay-opacity'])) ? esc_html($nectar_options['header-auto-title-overlay-opacity']) : false; // Auto page header bg color. if (empty($bg_color)) { $bg_color = (!empty($nectar_options['overall-bg-color'])) ? $nectar_options['overall-bg-color'] : '#ffffff'; if ($auto_header_bg_color) { $bg_color = $auto_header_bg_color; } } // Auto page header overlay color default. if (empty($bg_overlay_color)) { $bg_overlay_color = 'rgba(0,0,0,0.07)'; } // Auto page header featured image. if ($bg_type === 'image_bg' && empty($bg) && $auto_header_featured_img) { if (has_post_thumbnail($post->ID)) { $bg = wp_get_attachment_url(get_post_thumbnail_id()); $bg_position = 'center'; if ($auto_header_overlay_color) { $bg_overlay_color = $auto_header_overlay_color; } } } if (empty($height)) { $height = '225'; } } else { $title = get_post_meta($postid, '_nectar_header_title', true); } // Theme option: Single Post Header Inherits Featured Image $single_post_header_inherit_fi = (!empty($nectar_options['blog_post_header_inherit_featured_image'])) ? $nectar_options['blog_post_header_inherit_featured_image'] : '0'; if (empty($bg) && $single_post_header_inherit_fi === '1' && $is_blog_header_post_type && $post->ID != 0 && is_single()) { if (has_post_thumbnail($post->ID)) { $bg = wp_get_attachment_url(get_post_thumbnail_id()); $bg_position = 'center'; } } // Empty image bg. $early_exit = (isset($post->post_type) && $post->post_type === 'page' && $bg_type === 'image_bg' && empty($bg_color) && empty($bg) && empty($height) && empty($title)) ? true : false; $headerRemoveStickiness = (!empty($nectar_options['header-remove-fixed'])) ? $nectar_options['header-remove-fixed'] : '0'; $header_format = (!empty($nectar_options['header_format'])) ? $nectar_options['header_format'] : 'default'; $condense_header_on_scroll = (!empty($nectar_options['condense-header-on-scroll']) && $header_format === 'centered-menu-bottom-bar' && $headerRemoveStickiness != '1' && $nectar_options['condense-header-on-scroll'] === '1') ? 'true' : 'false'; $parallax_bg = get_post_meta($postid, '_nectar_header_parallax', true); $fullscreen_rows = get_post_meta($postid, '_nectar_full_screen_rows', true); $box_roll = get_post_meta($postid, '_nectar_header_box_roll', true); $text_align = get_post_meta($postid, '_nectar_page_header_alignment', true); $text_align_v = get_post_meta($postid, '_nectar_page_header_alignment_v', true); if ($fullscreen_rows === 'on' || $early_exit) { return; } $page_header_bg_attrs = ''; $page_header_classes = array(); $product_archive_parallax_effect = (isset($nectar_options['product_archive_header_parallax']) && '1' === $nectar_options['product_archive_header_parallax']) ? true : false; if (function_exists('woocommerce_page_title') && $woocommerce) { $product_archive_header_size = (isset($nectar_options['product_archive_header_size'])) ? $nectar_options['product_archive_header_size'] : 'default'; $product_archive_auto_height = (isset($nectar_options['product_archive_header_auto_height'])) ? $nectar_options['product_archive_header_auto_height'] : '0'; // Woocommerce archives. if (is_product_category() || is_product_tag() || is_product_taxonomy()) { $subtitle = ''; $title = woocommerce_page_title(false); $cate = get_queried_object(); $t_id = (property_exists($cate, 'term_id')) ? $cate->term_id : ''; $product_terms = get_option("taxonomy_$t_id"); $bg = (!empty($product_terms['product_category_image'])) ? $product_terms['product_category_image'] : $bg; // Taxonomy custom alignment. $content_align = (isset($product_terms['product_category_header_content_align'])) ? $product_terms['product_category_header_content_align'] : ''; if (!empty($content_align) && 'default' !== $content_align) { $text_align = esc_attr($content_align); $text_align_v = 'middle'; } if ('contained' === $product_archive_header_size || true === $product_archive_parallax_effect) { $parallax_bg = ''; $box_roll = 'off'; } if ('1' === $product_archive_auto_height) { $text_align_v = 'middle'; $text_align = 'left'; } if (true === $product_archive_parallax_effect) { $page_header_classes[] = 'parallax-layer'; $page_header_bg_attrs = ' data-n-parallax-bg="true" data-parallax-speed="fast" '; } } // Woocommerce main shop. else if (is_shop()) { if ('contained' === $product_archive_header_size || true === $product_archive_parallax_effect) { $parallax_bg = ''; $box_roll = 'off'; } if ('1' === $product_archive_auto_height) { $text_align_v = 'middle'; $text_align = 'left'; } if (true === $product_archive_parallax_effect) { $page_header_classes[] = 'parallax-layer'; $page_header_bg_attrs = ' data-n-parallax-bg="true" data-parallax-speed="fast" '; } } } $page_template = get_post_meta($postid, '_wp_page_template', true); $display_sortable = get_post_meta($postid, 'nectar-metabox-portfolio-display-sortable', true); $inline_filters = (!empty($nectar_options['portfolio_inline_filters']) && $nectar_options['portfolio_inline_filters'] === '1') ? '1' : '0'; $filters_id = (!empty($nectar_options['portfolio_inline_filters']) && $nectar_options['portfolio_inline_filters'] === '1') ? 'portfolio-filters-inline' : 'portfolio-filters'; $fullscreen_header = (!empty($nectar_options['blog_header_type']) && $nectar_options['blog_header_type'] === 'fullscreen' && is_singular('post')) ? true : false; if ($is_blog_header_post_type && isset($nectar_options['blog_header_type']) && $nectar_options['blog_header_type'] === 'fullscreen') { $fullscreen_header = true; } $post_header_style = (!empty($nectar_options['blog_header_type'])) ? $nectar_options['blog_header_type'] : 'default'; $bottom_shadow = get_post_meta($postid, '_nectar_header_bottom_shadow', true); $bg_overlay = get_post_meta($postid, '_nectar_header_overlay', true); $text_effect = get_post_meta($postid, '_nectar_page_header_text-effect', true); $blog_header_sizing = (isset($nectar_options['blog_header_sizing']) && !empty($nectar_options['blog_header_sizing'])) ? $nectar_options['blog_header_sizing'] : 'default'; $animate_in_effect = (!empty($nectar_options['header-animate-in-effect'])) ? $nectar_options['header-animate-in-effect'] : 'none'; $on_blog_archive = ((is_category() || is_author() || is_tag() || is_date()) && 'post' === get_post_type()) ? true : false; (!empty($display_sortable) && $display_sortable === 'on') ? $display_sortable = '1' : $display_sortable = '0'; // Filter subtitle. $subtitle = apply_filters('nectar_page_header_subtitle', $subtitle); // If no title is entered for portfolio, still show the filters. if ($page_template === 'template-portfolio.php' && empty($title)) { $title = get_the_title($post->ID); } if ((!empty($bg) || !empty($bg_color) || $bg_type === 'video_bg' || $bg_type === 'particle_bg') && false === $on_blog_archive) { $social_img_src = (empty($bg)) ? 'none' : $bg; $bg = (empty($bg)) ? 'none' : $bg; if ($bg_type === 'image_bg' || $bg_type === 'particle_bg') { // Do not set #000 for default minimal page header if (empty($bg_color) && is_singular('post') && 'default_minimal' === $post_header_style) { $bg_color = false; } else { (empty($bg_color)) ? $bg_color = '#000' : $bg_color; } } else { $bg = 'none'; // remove stnd bg image for video BG type } $bg_color_string = (!empty($bg_color)) ? 'background-color: ' . esc_attr($bg_color) . '; ' : null; if ($bg_type === 'particle_bg') { $rotate_timing = get_post_meta($postid, '_nectar_particle_rotation_timing', true); $disable_explosion = get_post_meta($postid, '_nectar_particle_disable_explosion', true); $shapes = get_post_meta($postid, '_nectar_canvas_shapes', true); if (empty($shapes)) { $bg_type = 'image_bg'; } } if ($bg_type === 'video_bg') { $video_webm = get_post_meta($postid, '_nectar_media_upload_webm', true); $video_mp4 = get_post_meta($postid, '_nectar_media_upload_mp4', true); $video_ogv = get_post_meta($postid, '_nectar_media_upload_ogv', true); $video_image = get_post_meta($postid, '_nectar_slider_preview_image', true); if (empty($video_webm) && empty($video_mp4) && empty($video_ogv) && empty($title)) { return; } } if (!empty($nectar_options['boxed_layout']) && $nectar_options['boxed_layout'] === '1' || $condense_header_on_scroll == 'true') { $box_roll = 'off'; } if ($post_header_style === 'default_minimal' && (isset($post->post_type) && in_array($post->post_type, $blog_post_type_list) && is_single())) { $height = (!empty($height)) ? preg_replace('/\s+/', '', $height) : 550; } else { $height = (!empty($height)) ? preg_replace('/\s+/', '', $height) : 350; } // Mobile padding calc. if (intval($height) < 350) { $mobile_padding_influence = 'low'; } else if (intval($height) < 600) { $mobile_padding_influence = 'normal'; } else { $mobile_padding_influence = 'high'; } // Blog header effect. $post_header_parallax = (isset($nectar_options['blog_header_scroll_effect']) && !empty($nectar_options['blog_header_scroll_effect'])) ? $nectar_options['blog_header_scroll_effect'] : 'default'; if (is_singular('post') && 'parallax' === $post_header_parallax) { $parallax_bg = 'on'; } // Blog responsive sizing. $responsive_sizing = ''; $responsive_sizing_bool = false; if ('responsive' === $blog_header_sizing && is_singular('post') && true !== $fullscreen_header) { $height = '75vh'; $responsive_sizing = ' data-responsive="true"'; $responsive_sizing_bool = true; } $not_loaded_class = ($nectar_theme_skin !== 'ascend') ? "not-loaded " : null; $page_fullscreen_header = get_post_meta($postid, '_nectar_header_fullscreen', true); $fullscreen_class = ($fullscreen_header == true || $page_fullscreen_header === 'on') ? "fullscreen-header" : ''; $bottom_shadow_class = ($bottom_shadow === 'on') ? " bottom-shadow" : null; $bg_overlay_class = ($bg_overlay === 'on') ? " bg-overlay" : null; $ajax_page_loading = (!empty($nectar_options['ajax-page-loading']) && $nectar_options['ajax-page-loading'] === '1') ? true : false; $hentry_post_class = (isset($post->post_type) && $post->post_type === 'post' && is_single()) ? ' hentry' : ''; if ($animate_in_effect === 'slide-down' && true !== $responsive_sizing_bool) { $wrapper_height_style = null; } elseif (strpos($height, 'vh') !== false) { $wrapper_height_style = 'style="height: ' . $height . ';"'; } else { $wrapper_height_style = 'style="height: ' . $height . 'px;"'; } // Disable slide down for fullscreen headers. if ($fullscreen_header == true && $is_blog_header_post_type || $page_fullscreen_header === 'on') { $wrapper_height_style = null; } // Force transparent coloring. $force_transparent_header_color = nectar_get_forced_transparent_header_color(); if (empty($force_transparent_header_color)) { $force_transparent_header_color = 'light'; } $midnight_non_parallax = (!empty($parallax_bg) && $parallax_bg === 'on') ? null : 'data-midnight="light"'; $regular_page_header_midnight_override = 'data-midnight="' . $force_transparent_header_color . '"'; $page_header_wrap_classes = array(); if (!empty($fullscreen_class)) { $page_header_wrap_classes[] = $fullscreen_class; } $page_header_wrap_classes = apply_filters('nectar_page_header_wrap_class_name', $page_header_wrap_classes); $page_header_wrap_classes = implode(' ', $page_header_wrap_classes); $page_header_classes = implode(' ', $page_header_classes); // Begin output. if ($box_roll !== 'on') { echo '