File: /home/dh_5jabqq/bermudashipwreckarchive.com/wp-content/themes/loquet/includes/title-bar.php
<?php
/*======
*
* Title Bar
*
======*/
if( !function_exists( 'loquet_title_bar' ) ) {
function loquet_title_bar() {
/*====== Customizer Settings ======*/
$title_bar = get_theme_mod( 'loquet_title_bar', '1' );
$style = get_theme_mod( 'loquet_title_bar_style', 'style-1' );
$skin = get_theme_mod( 'loquet_title_bar_skin', 'dark' );
$width = get_theme_mod( 'loquet_title_bar_width', 'narrow' );
$align = get_theme_mod( 'loquet_title_bar_align', 'center' );
$title_bar_title = get_theme_mod( 'loquet_title_bar_title', '1' );
$title_bar_subtitle = get_theme_mod( 'loquet_title_bar_subtitle', '1' );
$title_bar_text = get_theme_mod( 'loquet_title_bar_text', '1' );
/*====== Function Settings ======*/
$title = loquet_page_titles();
$subtitle = "";
$text = "";
if( is_tax() or is_category() ) {
$text = category_description();
} elseif( is_single() or is_page() ) {
$text = category_description();
}
if( is_singular( 'post' ) ) {
$subtitle = get_the_title();
$title = sprintf( esc_html__( '%s Blog', 'loquet' ), esc_attr( get_bloginfo( 'name' ) ) );
}
if( class_exists( 'woocommerce' ) ) {
if( is_shop() ) {
$title = esc_html__( 'Shop', 'loquet' );
}
}
/*====== Metabox Settings ======*/
$page_title_bar = "";
$page_style = "";
$page_skin = "";
$page_width = "";
$page_align = "";
$page_title_bar_title = "";
$page_title_bar_custom_title = "";
$page_title_bar_subtitle = "";
$page_title_bar_custom_subtitle = "";
$page_title_bar_text = "";
$page_title_bar_custom_text = "";
if( function_exists( 'rwmb_meta' ) ) {
if( is_single() or is_page() ) {
$page_title_bar = rwmb_meta( 'loquet-title-bar' );
$page_style = rwmb_meta( 'loquet-title-bar-style' );
$page_skin = rwmb_meta( 'loquet-title-bar-skin' );
$page_width = rwmb_meta( 'loquet-title-bar-width' );
$page_align = rwmb_meta( 'loquet-title-bar-alignment' );
$page_title_bar_title = rwmb_meta( 'loquet-title-bar-title' );
$page_title_bar_custom_title = rwmb_meta( 'loquet-title-bar-custom-title' );
$page_title_bar_subtitle = rwmb_meta( 'loquet-title-bar-subtitle' );
$page_title_bar_custom_subtitle = rwmb_meta( 'loquet-title-bar-custom-subtitle' );
$page_title_bar_text = rwmb_meta( 'loquet-title-bar-text' );
$page_title_bar_custom_text = rwmb_meta( 'loquet-title-bar-custom-text' );
}
}
if( $page_title_bar !== "default" and !empty( $page_title_bar ) or $page_title_bar == "0" ) {
$title_bar = esc_attr( $page_title_bar );
}
if( $page_style !== "default" and !empty( $page_style ) ) {
$style = esc_attr( $page_style );
}
if( $page_skin !== "default" and !empty( $page_skin ) ) {
$skin = esc_attr( $page_skin );
}
if( $page_width !== "default" and !empty( $page_width ) ) {
$width = esc_attr( $page_width );
}
if( $page_align !== "default" and !empty( $page_align ) ) {
$align = esc_attr( $page_align );
}
if( $page_title_bar_title !== "default" and !empty( $page_title_bar_title ) or $page_title_bar_title == "0" ) {
$title_bar_title = esc_attr( $page_title_bar_title );
}
if( $page_title_bar_subtitle !== "default" and !empty( $page_title_bar_subtitle ) or $page_title_bar_subtitle == "0" ) {
$title_bar_subtitle = esc_attr( $page_title_bar_subtitle );
}
if( $page_title_bar_text !== "default" and !empty( $page_title_bar_text ) or $page_title_bar_text == "0" ) {
$title_bar_text = esc_attr( $page_title_bar_text );
}
if( $page_title_bar_custom_title !== "default" and !empty( $page_title_bar_custom_title ) ) {
$title = esc_attr( $page_title_bar_custom_title );
}
if( $page_title_bar_custom_subtitle !== "default" and !empty( $page_title_bar_custom_subtitle ) ) {
$subtitle = esc_attr( $page_title_bar_custom_subtitle );
}
if( $page_title_bar_custom_text !== "default" and !empty( $page_title_bar_custom_text ) ) {
$text = esc_attr( $page_title_bar_custom_text );
}
/*====== HTML Output ======*/
$output = "";
if( $title_bar == "1" ) {
$output .= '<div class="gt-title-bar gt-' . esc_attr( $style ) . ' gt-' . esc_attr( $skin ) . ' gt-align-' . esc_attr( $align ) . '">';
if( $width == "wide" ) {
$output .= '<div class="gt-container-full">';
} else {
$output .= '<div class="gt-container">';
}
if( $style == "style-1" ) {
$output .= '<div class="gt-content">';
if( $title_bar_subtitle == "1" ) {
if( !empty( $subtitle ) ) {
$output .= '<span>' . esc_attr( $subtitle ) . '</span>';
}
}
if( $title_bar_title == "1" ) {
if( !empty( $title ) ) {
$output .= '<h1>' . loquet_sanitize_html( $title ) . '</h1>';
}
}
if( $title_bar_text == "1" ) {
if( !empty( $text ) ) {
$output .= wpautop( $text );
}
}
$output .= '</div>';
} elseif( $style == "style-2" or $style == "style-3" ) {
$output .= '<div class="gt-content">';
if( $title_bar_subtitle == "1" or $title_bar_title == "1" ) {
if( !empty( $subtitle ) or !empty( $title ) ) {
$output .= '<div class="gt-left">';
if( $title_bar_title == "1" ) {
if( !empty( $title ) ) {
$output .= '<h1>' . loquet_sanitize_html( $title ) . '</h1>';
}
}
if( $title_bar_subtitle == "1" ) {
if( !empty( $subtitle ) ) {
$output .= '<span>' . esc_attr( $subtitle ) . '</span>';
}
}
$output .= '</div>';
}
}
if( $title_bar_text == "1" ) {
if( !empty( $text ) ) {
$output .= '<div class="gt-right">';
$output .= wpautop( $text );
$output .= '</div>';
}
}
$output .= '</div>';
}
if( is_singular( 'exhibition' ) ) {
$output .= loquet_exhibition_details( $exhibition_id = get_the_ID() );
}
if( is_singular( 'collection' ) ) {
$output .= loquet_collection_details( $exhibition_id = get_the_ID() );
}
$output .= '</div>';
$output .= '</div>';
}
return $output;
}
}
/*======
*
* Page Titles
*
======*/
if( !function_exists( 'loquet_page_titles' ) ) {
function loquet_page_titles() {
/*====== Settings ======*/
if( is_category() ) {
$title = single_cat_title( '', false );
} elseif( is_tag() ) {
$title = single_tag_title( '', false );
} elseif( is_search() ) {
$title = sprintf( esc_html__( 'Search results for: %s', 'loquet' ), get_search_query() );
} elseif( is_author() ) {
$title = get_the_author();
} elseif( is_home() ) {
$title = esc_html__( 'Home', 'loquet' );
} elseif( is_404() ) {
$title = esc_html__( '404 Page', 'loquet' );
} elseif( is_attachment() or is_page() or is_single() ) {
$title = get_the_title();
} elseif( is_tax() ) {
$title = single_term_title( '', false );
} elseif( is_post_type_archive() ) {
$title = post_type_archive_title( '', false );
} else {
if( is_day() or is_month() or is_year() ) {
$title = get_the_archive_title();
} else {
$title = esc_html__( 'Archive', 'loquet' );
}
}
/*====== HTML Output ======*/
return $title;
}
}