Exemplo n.º 1
0
    /**
     * Displays the page header
     *
     * @param  bool $placed whether the title has already been output
     * @param  string|null $title if set, overrides the current post title
     */
    public static function page_header($placed = false, $title = null)
    {
        if ($placed) {
            return;
        }
        global $post;
        if (is_null($title)) {
            $title = get_the_title();
        }
        $needHeaderTitle = WpvTemplates::has_page_header();
        $needButtons = WpvTemplates::has_post_siblings_buttons();
        $titleColor = WpvTemplates::page_header_title_color();
        $description = '';
        if (is_category()) {
            $description = category_description();
        } else {
            if (is_object($post)) {
                $description = get_post_meta($post->ID, 'description', true);
            }
        }
        if (has_post_format('link') && !empty($title)) {
            $title = "<a href='" . wpv_post_meta(wpv_get_the_ID(), 'wpv-post-format-link') . "' target='_blank'>{$title}</a>";
        }
        if ($needHeaderTitle || $needButtons) {
            ?>
<header class="page-header <?php 
            echo esc_attr($needButtons ? 'has-buttons' : '');
            ?>
">
				<div class="page-header-content">
					<?php 
            if ($needHeaderTitle && !empty($title)) {
                ?>
						<h1 style="<?php 
                echo esc_attr($titleColor);
                ?>
">
							<span class="title">
								<?php 
                echo wp_kses_post($title);
                ?>
								<?php 
                if (!empty($description)) {
                    ?>
									<div class="desc"><?php 
                    echo wp_kses_post($description);
                    ?>
</div>
								<?php 
                }
                ?>
							</span>
						</h1>
					<?php 
            }
            ?>
					<?php 
            if ($needButtons) {
                get_template_part('templates/post-siblings-links', $post->post_type);
            }
            ?>
				</div>
			</header><?php 
        }
    }
Exemplo n.º 2
0
function theme_body_classes($body_class)
{
    global $wpv_has_header_sidebars, $post, $wpv_is_shortcode_preview;
    $is_blank_page = is_page_template('page-blank.php');
    $has_header_slider = WpvTemplates::has_header_slider();
    $wpv_has_header_sidebars = wpv_post_meta_default('show_header_sidebars', 'has-header-sidebars');
    $has_page_header = (WpvTemplates::has_page_header() || WpvTemplates::has_post_siblings_buttons()) && !is_404();
    $body_class[] = $is_blank_page ? 'full' : wpv_get_option('site-layout-type');
    $body_class[] = 'pagination-' . wpv_get_option('pagination-type');
    $body_class[] = is_singular(WpvFramework::$complex_layout) ? 'sticky-header-type-' . wpv_post_meta(null, 'sticky-header-type', true) : '';
    $body_class[] = 'wpv-not-scrolled';
    $body_class_conditions = array('no-page-header' => !$has_page_header, 'has-page-header' => $has_page_header, 'cbox-share-twitter' => wpv_get_optionb('share-lightbox-twitter'), 'cbox-share-facebook' => wpv_get_optionb('share-lightbox-facebook'), 'cbox-share-googleplus' => wpv_get_optionb('share-lightbox-googleplus'), 'cbox-share-pinterest' => wpv_get_optionb('share-lightbox-pinterest'), 'fixed-header' => wpv_get_optionb('fixed-header'), 'has-header-slider' => $has_header_slider, 'has-header-sidebars' => $wpv_has_header_sidebars, 'no-header-slider' => !$has_header_slider, 'no-header-sidebars' => !$wpv_has_header_sidebars, 'no-footer-sidebars' => !wpv_get_optionb('has-footer-sidebars'), 'responsive-layout' => WPV_RESPONSIVE, 'fixed-layout' => !WPV_RESPONSIVE, 'has-breadcrumbs' => wpv_get_optionb('enable-breadcrumbs'), 'no-breadcrumbs' => !wpv_get_optionb('enable-breadcrumbs'), 'no-slider-button-thumbnails' => !wpv_get_optionb('header-slider-button-thumbnails'), 'sticky-header' => wpv_get_optionb('sticky-header'), 'no-page-bottom-padding' => wpv_post_meta(null, 'use-page-bottom-padding', true) == 'false', 'vamtam-shortcode-tooltip-preview' => $wpv_is_shortcode_preview && strpos($GLOBALS['wpv_current_shortcode'], '[tooltip') !== false);
    foreach ($body_class_conditions as $class => $cond) {
        if ($cond) {
            $body_class[] = $class;
        }
    }
    if (is_archive() || is_search() || get_query_var('format_filter')) {
        define('WPV_ARCHIVE_TEMPLATE', true);
    }
    return $body_class;
}
Exemplo n.º 3
0
 */
global $wpv_title;
if (!is_404()) {
    if (wpv_has_woocommerce() && is_woocommerce() && !is_single()) {
        if (is_product_category()) {
            $wpv_title = single_cat_title('', false);
        } elseif (is_product_tag()) {
            $wpv_title = single_tag_title('', false);
        } else {
            $wpv_title = woocommerce_get_page_id('shop') ? get_the_title(woocommerce_get_page_id('shop')) : '';
        }
    }
}
$page_header_bg = WpvTemplates::page_header_background();
$global_page_header_bg = wpv_get_option('page-title-background-image') . wpv_get_option('page-title-background-color');
if (!WpvTemplates::has_breadcrumbs() && !WpvTemplates::has_page_header() && !WpvTemplates::has_post_siblings_buttons() || is_404() && (!function_exists('tribe_is_event_query') || !tribe_is_event_query())) {
    return;
}
if (is_page_template('page-blank.php')) {
    return;
}
?>
<div id="sub-header" class="layout-<?php 
echo WpvTemplates::get_layout();
?>
 <?php 
if (!empty($page_header_bg) || !empty($global_page_header_bg)) {
    echo 'has-background';
}
?>
">