Advertisement
kenshin23

includes/post-head.php

Mar 27th, 2015
204
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 7.33 KB | None | 0 0
  1. <?php
  2. global $get_meta, $post;
  3.  
  4. if( ( empty( $get_meta['tie_post_head'][0] ) && tie_get_option( 'post_featured' ) ) || ( !empty( $get_meta['tie_post_head'][0] ) && $get_meta['tie_post_head'][0] == 'thumb' ) ){
  5.         if( $get_meta["tie_sidebar_pos"][0] == 'full' ){
  6.             $size = 'full';
  7.         }else{
  8.             $size = 'slider';
  9.         }?>
  10.         <div class="single-post-thumb">
  11.              <?php the_post_thumbnail( $size ); ?>
  12.         </div>
  13.         <?php $thumb_caption = get_post(get_post_thumbnail_id())->post_excerpt;
  14.             if( !empty($thumb_caption) ){ ?><div class="single-post-caption"><?php echo $thumb_caption ?></div> <?php } ?>
  15.        
  16. <?php }
  17.    
  18. elseif( !empty($get_meta['tie_post_head'][0]) && $get_meta['tie_post_head'][0] != 'none' ){
  19.    
  20.     $orig_post = $post;
  21.    
  22.     //Get Post Video
  23.     if( $get_meta['tie_post_head'][0] == 'video' ){
  24.         if( isset( $get_meta["tie_video_url"][0] ) && !empty( $get_meta["tie_video_url"][0] ) ){
  25.        
  26.             $video_url = $get_meta["tie_video_url"][0];
  27.             $width  = '100%' ;
  28.             $height = '380';
  29.  
  30.             $video_link = @parse_url($video_url);
  31.             if ( $video_link['host'] == 'www.youtube.com' || $video_link['host']  == 'youtube.com' ) {
  32.                 parse_str( @parse_url( $video_url, PHP_URL_QUERY ), $my_array_of_vars );
  33.                 $video =  $my_array_of_vars['v'] ;
  34.                 $video_code ='<iframe width="'.$width.'" height="'.$height.'" src="http://www.youtube.com/embed/'.$video.'?rel=0&wmode=opaque" frameborder="0" allowfullscreen></iframe>';
  35.             }
  36.             elseif( $video_link['host'] == 'www.youtu.be' || $video_link['host']  == 'youtu.be' ){
  37.                 $video = substr(@parse_url($video_url, PHP_URL_PATH), 1);
  38.                 $video_code ='<iframe width="'.$width.'" height="'.$height.'" src="http://www.youtube.com/embed/'.$video.'?rel=0&wmode=opaque" frameborder="0" allowfullscreen></iframe>';
  39.             }elseif( $video_link['host'] == 'www.vimeo.com' || $video_link['host']  == 'vimeo.com' ){
  40.                 $video = (int) substr(@parse_url($video_url, PHP_URL_PATH), 1);
  41.                 $video_code='<iframe src="http://player.vimeo.com/video/'.$video.'?wmode=opaque" width="'.$width.'" height="'.$height.'" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>';
  42.             }
  43.             elseif( $video_link['host'] == 'www.dailymotion.com' || $video_link['host']  == 'dailymotion.com' ){
  44.                 $video = substr(@parse_url($video_url, PHP_URL_PATH), 7);
  45.                 $video_id = strtok($video, '_');
  46.                 $video_code='<iframe frameborder="0" width="'.$width.'" height="'.$height.'" src="http://www.dailymotion.com/embed/video/'.$video_id.'"></iframe>';
  47.             }
  48.         }
  49.         elseif( isset( $get_meta["tie_embed_code"][0] ) ){
  50.             $embed_code = $get_meta["tie_embed_code"][0];
  51.             $embed_code = htmlspecialchars_decode( $embed_code);
  52.             $width = 'width="100%"';
  53.             $height = 'height="450"';
  54.             $embed_code = preg_replace('/width="([3-9][0-9]{2,}|[1-9][0-9]{3,})"/',$width,$embed_code);
  55.             $video_code = preg_replace( '/height="([0-9]*)"/' , $height , $embed_code );
  56.         }
  57.         if( isset($video_code) ){ ?>
  58.         <div class="single-post-video">
  59.             <?php echo $video_code; ?>
  60.         </div>
  61.         <?php  
  62.         }
  63.     }elseif( $get_meta['tie_post_head'][0] == 'audio' ){
  64.         if( !empty( $get_meta["tie_audio_mp3"][0] ) || !empty( $get_meta["tie_audio_m4a"][0] ) || !empty( $get_meta["tie_audio_oga"][0] ) ){
  65.             if( $get_meta["tie_sidebar_pos"][0] == 'full' ){
  66.                 $size = 'full';
  67.             }else{
  68.                 $size = 'slider';
  69.             }
  70.            
  71.             if ( !has_post_thumbnail($post->ID) ) $style =' style="bottom:0;"'; ?>
  72.             <div class="single-post-audio single-post-thumb">
  73.                 <?php the_post_thumbnail( $size ); ?>
  74.                 <div class="single-audio"<?php echo $style ?>><?php tie_audio(); ?></div>
  75.             </div>
  76.     <?php
  77.         }
  78.     }elseif( $get_meta['tie_post_head'][0] == 'soundcloud' ){
  79.         if( !empty( $get_meta["tie_audio_soundcloud"][0] ) ){
  80.             $play = 'false';
  81.             if( !empty( $get_meta["tie_audio_soundcloud_play"][0] )) $play = 'true';
  82.             echo tie_soundcloud($get_meta["tie_audio_soundcloud"][0] , $play );?>
  83.     <?php
  84.         }
  85.     }elseif( $get_meta['tie_post_head'][0] == 'lightbox' && has_post_thumbnail($post->ID)){
  86.  
  87.         $image_id = get_post_thumbnail_id($post->ID);  
  88.         $image_url = wp_get_attachment_image_src($image_id,'large');  
  89.         $image_url = $image_url[0];
  90.    
  91.         if( $get_meta["tie_sidebar_pos"][0] == 'full' ){
  92.             $size ='full';
  93.         }else{
  94.             $size = 'slider';
  95.         }?>
  96.         <div class="single-post-thumb head-lightbox">
  97.             <a href="<?php echo $image_url; ?>" rel="prettyPhoto"><?php the_post_thumbnail( $size ) ; ?></a>
  98.         </div>
  99.         <?php $thumb_caption = get_post(get_post_thumbnail_id())->post_excerpt;
  100.             if( !empty($thumb_caption) ){ ?><div class="single-post-caption"><?php echo $thumb_caption ?></div> <?php } ?>
  101.            
  102. <?php } elseif( $get_meta['tie_post_head'][0] == 'map' && !empty( $get_meta['tie_googlemap_url'][0] ) ){
  103.         if( $get_meta["tie_sidebar_pos"][0] == 'full' ){
  104.             $width = 1003 ;
  105.             $height = 498 ;
  106.         }else{
  107.             $width = 620;
  108.             $height = 330 ;
  109.         }?>
  110.         <?php echo tie_google_maps( $get_meta['tie_googlemap_url'][0] , $width , $height ); ?>
  111.        
  112.        
  113. <?php
  114. }elseif( $get_meta['tie_post_head'][0] == 'slider' && !empty( $get_meta['tie_post_slider'][0] ) ){
  115.  
  116.     if( $get_meta["tie_sidebar_pos"][0] == 'full' ){
  117.         $size = 'full';
  118.     }else{
  119.         $size = 'slider';
  120.     }
  121.     $effect = tie_get_option( 'flexi_slider_effect' );
  122.     $speed = tie_get_option( 'flexi_slider_speed' );
  123.     $time = tie_get_option( 'flexi_slider_time' );
  124.    
  125.     if( !$speed || $speed == ' ' || !is_numeric($speed))    $speed = 7000 ;
  126.     if( !$time || $time == ' ' || !is_numeric($time))   $time = 600;
  127.    
  128.     if( $effect == 'slideV' )
  129.             $effect = 'animation: "slide",
  130.                       direction: "vertical",';
  131.     elseif( $effect == 'slideH' )
  132.                 $effect = 'animation: "slide",';
  133.     else
  134.         $effect = 'animation: "fade",';
  135.        
  136.         $custom_slider_args = array( 'post_type' => 'tie_slider', 'no_found_rows' => 1, 'p' => $get_meta['tie_post_slider'][0] );
  137.         $custom_slider = new WP_Query( $custom_slider_args );
  138.     ?>
  139.     <div class="flexslider" id="flexslider-post">
  140.         <ul class="slides">
  141.         <?php while ( $custom_slider->have_posts() ) : $custom_slider->the_post();
  142.             $custom = get_post_custom($post->ID);
  143.             $slider = unserialize( $custom["custom_slider"][0] );
  144.             $number = count($slider);
  145.                
  146.             if( $slider ){
  147.             foreach( $slider as $slide ): ?>   
  148.             <li>
  149.                 <?php if( !empty( $slide['link'] ) ):?><a href="<?php  echo stripslashes( $slide['link'] )  ?>"><?php endif; ?>
  150.                 <img src="<?php echo tie_slider_img_src( $slide['id'] , $size) ?>" alt="" />
  151.                 <?php if( !empty( $slide['link'] ) ):?></a><?php endif; ?>
  152.                 <?php if( !empty( $slide['title'] ) || !empty( $slide['caption'] ) ) :?>
  153.                 <div class="slider-caption">
  154.                     <?php if( !empty( $slide['title'] ) ):?><h2><?php if( !empty( $slide['link'] ) ):?><a href="<?php  echo stripslashes( $slide['link'] )  ?>"><?php endif; ?><?php  echo stripslashes( $slide['title'] )  ?><?php if( !empty( $slide['link'] ) ):?></a><?php endif; ?></h2><?php endif; ?>
  155.                     <?php if( !empty( $slide['caption'] ) ):?><p><?php echo stripslashes($slide['caption']) ; ?></p><?php endif; ?>
  156.                 </div>
  157.                 <?php endif; ?>
  158.             </li>
  159.             <?php endforeach;
  160.             }?>
  161.         <?php endwhile;?>
  162.         </ul>
  163.     </div>
  164.     <script>
  165.     jQuery(window).load(function() {
  166.       jQuery('#flexslider-post').flexslider({
  167.         <?php echo $effect  ?>
  168.         slideshowSpeed: <?php echo $speed ?>,
  169.         animationSpeed: <?php echo $time ?>,
  170.         randomize: false,
  171.         pauseOnHover: true,
  172.         prevText: "",
  173.         nextText: ""
  174.       });
  175.     });
  176.     </script>
  177. <?php }
  178.  
  179.     $post = $orig_post;
  180.     wp_reset_query();
  181.    
  182. } ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement