Skip to content

Instantly share code, notes, and snippets.

@aalimran07
Created July 13, 2018 04:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aalimran07/cdcaf3f717e5db25b63c89d4d6d5c1e2 to your computer and use it in GitHub Desktop.
Save aalimran07/cdcaf3f717e5db25b63c89d4d6d5c1e2 to your computer and use it in GitHub Desktop.
<?php
/**
* Page Banner Template.
*/
global $post;
$page_header_hide_option = '';
if( is_front_page() ) :
$page_header_hide_option = true;
else :
if(is_404()){
$page_header_hide_option = '';
$header_small_title = '';
$header_img = get_template_directory_uri().'/assets/images/banner.jpg';
}
elseif (is_home()){
$page_header_hide_option = true;
}
else{
if (function_exists('get_field')) {
$page_header_hide_option = get_field('header_on_off');
$header_small_title = get_field( 'page_title' );
$header_img = get_field( 'header_background' );
}
}
if(empty($header_img)) {
$header_img = get_template_directory_uri().'/asset/img/page-header.jpg';
}
endif;
if( $page_header_hide_option == true): ?>
<section id="page-banner" class="loanplus-page-header" style="background-image: url('<?php echo esc_url($header_img);?>');">
<div class="container">
<div class="row">
<div class="col-md-12 text-center">
<?php
global $post;
if( is_home() ){
echo '<h2>'.apply_filters( 'the_title', get_the_title( get_option( 'page_for_posts' ) ) ).'</h2>';
}elseif( is_singular() || is_page() ) {
if(!empty($header_small_title))
{
echo '<h2>'.$header_small_title.'</h2>';
}else{
the_title( '<h2>', '</h2>' );
}
}elseif( is_search() ) {
echo '<h2>'.esc_html__('Search','loanplus').': '.get_search_query().'</h2>';
}
else if ( is_404() ) {
// add search form so that users can search other posts
echo '<h2>'.esc_html__('404 Error','loanplus').'</h2>';
}
else if( is_archive() ) {
the_archive_title( '<h2>', '</h2>' );
}else {
the_title( '<h2>', '</h2>' );
}
if(function_exists('bcn_display')){
?>
<div class="breadcrumb-block">
<ol class="breadcrumb">
<li><?php bcn_display(); ?></li>
</ol>
</div>
<?php } ?>
</div>
</div>
</div>
</section>
<?php endif;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment