Advertisement
fahimmurshed

sub-header.php

Oct 24th, 2018
351
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.49 KB | None | 0 0
  1. <?php
  2.     $output = '';
  3.     $sub_img = array();
  4.     global $post;
  5.  
  6.  
  7.     if(!function_exists('thmtheme_call_sub_header')){
  8.         function thmtheme_call_sub_header(){
  9.             global $themeum_options;
  10.             if(isset($themeum_options['blog-banner']['url'])){
  11.                 $output = 'style="background-image:url('.esc_url($themeum_options['blog-banner']['url']).');background-size: cover;background-position: 50% 50%;padding: 65px 0;"';
  12.                 return $output;
  13.             }else{
  14.                  $output = 'style="background-color:'.esc_attr($themeum_options['blog-subtitle-bg-color']).';padding: 65px 0;"';
  15.                  return $output;
  16.             }
  17.         }
  18.     }
  19.    
  20.     if( isset($post->post_name) ){
  21.         if(!empty($post->ID)){
  22.             $image_attached = esc_attr(get_post_meta( $post->ID , 'thm_subtitle_images', true ));
  23.             if(!empty($image_attached)){
  24.                 $sub_img = wp_get_attachment_image_src( $image_attached , 'blog-full');
  25.                 $output = 'style="background-image:url('.esc_url($sub_img[0]).');background-size: cover;background-position: 50% 50%;padding: 65px 0;"';
  26.                 if(empty($sub_img[0])){
  27.                     $output = 'style="background-color:'.esc_attr(rwmb_meta("thm_subtitle_color")).';padding: 65px 0;"';
  28.                     if(rwmb_meta("thm_subtitle_color") == ''){
  29.                         $output = thmtheme_call_sub_header();
  30.                     }
  31.                 }
  32.             }else{
  33.                 if(rwmb_meta("thm_subtitle_color") != "" ){
  34.                     $output = 'style="background-color:'.esc_attr(rwmb_meta("thm_subtitle_color")).';padding: 65px 0;"';
  35.                 }else{
  36.                     $output = thmtheme_call_sub_header();
  37.                 }
  38.             }
  39.         }else{
  40.             $output = thmtheme_call_sub_header();
  41.         }
  42.     }else{
  43.             $output = thmtheme_call_sub_header();
  44.         }
  45. ?>
  46. <?php if (!is_front_page()) { ?>
  47.  
  48. <div class="sub-title" <?php echo $output;?>>
  49.     <div class="container">
  50.         <div class="sub-title-inner">
  51.             <div class="row">
  52.                 <div class="col-sm-12">
  53.                     <?php
  54.                         global $wp_query;
  55.                         if(isset($wp_query->queried_object->name)){
  56.                             if($wp_query->queried_object->name != ''){
  57.                                 if($wp_query->queried_object->name == 'product' ){
  58.                                     echo '<h2>'.esc_html__('Shop','zephyr').'</h2>';
  59.                                 }else{
  60.                                     echo '<h2 class="page-leading">'.$wp_query->queried_object->name.'</h2>';
  61.                                 }
  62.                             }else{
  63.                                 echo '<h2 class="page-leading">'.get_the_title().'</h2>';
  64.                             }
  65.                         }elseif(get_post_type() == 'page') {
  66.                             echo '<h2 class="page-leading">'.get_the_title().'</h2>';
  67.                         }elseif (is_single()) {
  68.                             if(get_post_type() == 'product'){
  69.                                 echo '<h2>'.esc_html__('Product Details','zephyr').'</h2>';
  70.                             }else {
  71.                                 echo '<h2>'.esc_html__('Single Post','zephyr').'</h2>';
  72.                             }
  73.                         }
  74.                     ?>
  75.                     <?php themeum_breadcrumbs(); ?>
  76.                 </div>
  77.             </div>
  78.         </div>
  79.     </div>
  80. </div>
  81.  
  82. <?php } ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement