File: //home/globfdxw/diasporameetsafrica.com/wp-content/themes/lavelo/theme-layouts/header/title-bar.php
<?php
// Metabox
$lavelo_id = ( isset( $post ) ) ? $post->ID : 0;
$lavelo_id = ( is_home() ) ? get_option( 'page_for_posts' ) : $lavelo_id;
$lavelo_meta = get_post_meta( $lavelo_id, 'page_type_metabox', true );
if ($lavelo_meta && is_page()) {
$lavelo_title_bar_padding = $lavelo_meta['title_area_spacings'];
} else { $lavelo_title_bar_padding = ''; }
// Padding - Theme Options
if ($lavelo_title_bar_padding && $lavelo_title_bar_padding !== 'padding-default') {
$lavelo_title_top_spacings = $lavelo_meta['title_top_spacings'];
$lavelo_title_bottom_spacings = $lavelo_meta['title_bottom_spacings'];
if ($lavelo_title_bar_padding === 'padding-custom') {
$lavelo_title_top_spacings = $lavelo_title_top_spacings ? 'padding-top:'. lavelo_check_px($lavelo_title_top_spacings) .';' : '';
$lavelo_title_bottom_spacings = $lavelo_title_bottom_spacings ? 'padding-bottom:'. lavelo_check_px($lavelo_title_bottom_spacings) .';' : '';
$lavelo_custom_padding = $lavelo_title_top_spacings . $lavelo_title_bottom_spacings;
} else {
$lavelo_custom_padding = '';
}
} else {
$lavelo_title_bar_padding = cs_get_option('title_bar_padding');
$lavelo_titlebar_top_padding = cs_get_option('titlebar_top_padding');
$lavelo_titlebar_bottom_padding = cs_get_option('titlebar_bottom_padding');
if ($lavelo_title_bar_padding === 'padding-custom') {
$lavelo_titlebar_top_padding = $lavelo_titlebar_top_padding ? 'padding-top:'. lavelo_check_px($lavelo_titlebar_top_padding) .';' : '';
$lavelo_titlebar_bottom_padding = $lavelo_titlebar_bottom_padding ? 'padding-bottom:'. lavelo_check_px($lavelo_titlebar_bottom_padding) .';' : '';
$lavelo_custom_padding = $lavelo_titlebar_top_padding . $lavelo_titlebar_bottom_padding;
} else {
$lavelo_custom_padding = '';
}
}
// Banner Type - Meta Box
if ($lavelo_meta && is_page()) {
$lavelo_banner_type = $lavelo_meta['banner_type'];
} else { $lavelo_banner_type = ''; }
// Header Style
if ($lavelo_meta) {
$lavelo_header_design = $lavelo_meta['select_header_design'];
$lavelo_hide_breadcrumbs = $lavelo_meta['hide_breadcrumbs'];
} else {
$lavelo_header_design = cs_get_option('select_header_design');
$lavelo_hide_breadcrumbs = cs_get_option('need_breadcrumbs');
}
if ( $lavelo_header_design === 'default') {
$lavelo_header_design_actual = cs_get_option('select_header_design');
} else {
$lavelo_header_design_actual = ( $lavelo_header_design ) ? $lavelo_header_design : cs_get_option('select_header_design');
}
if ( $lavelo_header_design_actual == 'style_three') {
$overly_class = ' overly';
} else {
$overly_class = ' ';
}
// Overlay Color - Theme Options
if ($lavelo_meta && is_page()) {
$lavelo_bg_overlay_color = $lavelo_meta['titlebar_bg_overlay_color'];
$title_color = isset( $lavelo_meta['title_color'] );
} else { $lavelo_bg_overlay_color = ''; }
if (!empty($lavelo_bg_overlay_color)) {
$lavelo_bg_overlay_color = $lavelo_bg_overlay_color;
$title_color = $title_color;
} else {
$lavelo_bg_overlay_color = cs_get_option('titlebar_bg_overlay_color');
$title_color = cs_get_option('title_color');
}
$e_uniqid = uniqid();
$inline_style = '';
if ( $lavelo_bg_overlay_color ) {
$inline_style .= '.crumbs-area-'.$e_uniqid .'.crumbs-area.overly:after {';
$inline_style .= ( $lavelo_bg_overlay_color ) ? 'background-color:'. $lavelo_bg_overlay_color.';' : '';
$inline_style .= '}';
}
if ( $title_color ) {
$inline_style .= '.crumbs-area-'.$e_uniqid .'.crumbs-area.overly .banner-content h2, .crumbs-area-'.$e_uniqid .'.crumbs-area.overly .crumbs ul li span, .crumbs-area-'.$e_uniqid .'.crumbs-area.overly .crumbs ul li a {';
$inline_style .= ( $title_color ) ? 'color:'. $title_color.';' : '';
$inline_style .= '}';
}
// add inline style
add_inline_style( $inline_style );
$styled_class = ' crumbs-area-'.$e_uniqid;
// Background - Type
if( $lavelo_meta ) {
$title_bar_bg = $lavelo_meta['title_area_bg'];
} else {
$title_bar_bg = '';
}
$lavelo_custom_header = get_custom_header();
$header_text_color = get_theme_mod( 'header_textcolor' );
$background_color = get_theme_mod( 'background_color' );
if( isset( $title_bar_bg['image'] ) && ( $title_bar_bg['image'] || $title_bar_bg['color'] ) ) {
extract( $title_bar_bg );
$lavelo_background_image = ( ! empty( $image ) ) ? 'background-image: url(' . esc_url($image) . ');' : '';
$lavelo_background_repeat = ( ! empty( $image ) && ! empty( $repeat ) ) ? ' background-repeat: ' . esc_attr( $repeat) . ';' : '';
$lavelo_background_position = ( ! empty( $image ) && ! empty( $position ) ) ? ' background-position: ' . esc_attr($position) . ';' : '';
$lavelo_background_size = ( ! empty( $image ) && ! empty( $size ) ) ? ' background-size: ' . esc_attr($size) . ';' : '';
$lavelo_background_attachment = ( ! empty( $image ) && ! empty( $size ) ) ? ' background-attachment: ' . esc_attr( $attachment ) . ';' : '';
$lavelo_background_color = ( ! empty( $color ) ) ? ' background-color: ' . esc_attr( $color ) . ';' : '';
$lavelo_background_style = ( ! empty( $image ) ) ? $lavelo_background_image . $lavelo_background_repeat . $lavelo_background_position . $lavelo_background_size . $lavelo_background_attachment : '';
$lavelo_title_bg = ( ! empty( $lavelo_background_style ) || ! empty( $lavelo_background_color ) ) ? $lavelo_background_style . $lavelo_background_color : '';
} elseif( $lavelo_custom_header->url ) {
$lavelo_title_bg = 'background: url('. esc_url( $lavelo_custom_header->url ) .') center center/cover no-repeat local ;';
} else {
$lavelo_title_bg = 'background: url( '.LAVELO_IMAGES.'/page-title.jpg ) center center/cover no-repeat local ;';
}
if($lavelo_banner_type === 'hide-title-area') { // Hide Title Area
} elseif($lavelo_meta && $lavelo_banner_type === 'revolution-slider') { // Hide Title Area
echo do_shortcode($lavelo_meta['page_revslider']);
} else {
?>
<!-- start page-title -->
<section class="page-title <?php echo esc_attr( $overly_class.$styled_class.' '.$lavelo_banner_type ); ?>" style="<?php echo esc_attr( $lavelo_custom_padding.$lavelo_title_bg ); ?>">
<div class="container">
<div class="row">
<div class="col col-xs-12">
<div class="title">
<h2><?php echo lavelo_title_area(); ?></h2>
</div>
</div>
</div> <!-- end row -->
<?php if ( !$lavelo_hide_breadcrumbs && function_exists( 'breadcrumb_trail' )) { breadcrumb_trail(); } ?>
</div> <!-- end container -->
</section>
<!-- end page-title -->
<?php } ?>