Advertisement
rejuancse

sub-header

Sep 19th, 2018
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 4.12 KB | None | 0 0
  1. <?php
  2.     $output = '';
  3.     $sub_img = array();
  4.     global $post;
  5.     if(!function_exists('moview_call_sub_header')){
  6.         function moview_call_sub_header(){
  7.             if( moview_options_url('blog-banner','url')){
  8.                 $output = 'style="background-image:url('.esc_url( moview_options_url('blog-banner','url')).');background-size: cover;background-position: 50% 50%;padding: 65px 0;"';
  9.                 return $output;
  10.             }else{
  11.                 if( moview_options('blog-subtitle-bg-color') ){
  12.                     $output = 'style="background-color:'.esc_attr(moview_options('blog-subtitle-bg-color')).';padding: 65px 0;"';
  13.                     return $output;
  14.                 }else{
  15.                     $output = 'style="background-color:#ccc; padding: 65px 0;"';
  16.                     return $output;
  17.                 }
  18.             }
  19.         }
  20.     }
  21.    
  22.     if( isset($post->post_name) ){
  23.         if(!empty($post->ID)){
  24.             if(function_exists('rwmb_meta')){
  25.                 $image_attached = esc_attr(get_post_meta( $post->ID , 'themeum_subtitle_images', true ));
  26.                 if(!empty($image_attached)){
  27.                     $sub_img = wp_get_attachment_image_src( $image_attached , 'blog-full');
  28.                     $output = 'style="background-image:url('.esc_url($sub_img[0]).');background-size: cover;background-position: 50% 50%;padding: 70px 0;"';
  29.                     if(empty($sub_img[0])){
  30.                         $output = 'style="background-color:'.esc_attr(rwmb_meta("themeum_subtitle_color")).';padding: 70px 0;"';
  31.                         if(rwmb_meta("themeum_subtitle_color") == ''){
  32.                             $output = moview_call_sub_header();
  33.                         }
  34.                     }
  35.                 }elseif(is_shop()) {
  36.                     $shop = get_option( 'woocommerce_shop_page_id' );
  37.                     $image_attached = esc_attr(get_post_meta( $shop , 'themeum_subtitle_images', true ));
  38.                     $sub_img = wp_get_attachment_image_src( $image_attached , 'blog-full');
  39.                     $output = 'style="background-image:url('.esc_url($sub_img[0]).');background-size: cover;background-position: 50% 50%;padding: 70px 0;"';
  40.                 }else{
  41.                     if(rwmb_meta("themeum_subtitle_color") != "" ){
  42.                         $output = 'style="background-color:'.esc_attr(rwmb_meta("themeum_subtitle_color")).'; padding: 70px 0;"';
  43.                     }else{
  44.                         $output = moview_call_sub_header();
  45.                     }
  46.                 }
  47.             }else{
  48.                 $output = moview_call_sub_header();
  49.             }
  50.         }else{
  51.             $output = moview_call_sub_header();
  52.         }
  53.     }else{
  54.         $output = moview_call_sub_header();
  55.     }
  56. ?>
  57. <?php if (!is_front_page()) { ?>
  58.  
  59. <div class="sub-title" <?php echo $output;?>>
  60.     <div class="container">
  61.         <div class="sub-title-inner">
  62.             <div class="row">
  63.                 <div class="col-sm-12">
  64.                     <?php
  65.                     global $wp_query;
  66.  
  67.                     if(isset($wp_query->queried_object->name)){
  68.                         if($wp_query->queried_object->name != ''){
  69.                             if($wp_query->queried_object->name == 'product' ){
  70.                                 echo '<h2>'.__('Shop','moview').'</h2>';
  71.                             }else{
  72.                                 echo '<h2>'.$wp_query->queried_object->name.'</h2>';    
  73.                             }
  74.                         }else{
  75.                             echo '<h2>'.get_the_title().'</h2>';
  76.                         }
  77.                     }else{
  78.                         if( is_search() ){
  79.                             $first_char = __('Search','moview');
  80.                             echo '<h2>'.$first_char.'</h2>';
  81.                         }else{
  82.                             echo '<h2>'.get_the_title().'</h2>';
  83.                         }
  84.                     }
  85.                     ?>
  86.                     <?php moview_breadcrumbs(); ?>
  87.                 </div>
  88.             </div>
  89.         </div>
  90.     </div>
  91. </div>
  92.  
  93. <?php } ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement