Advertisement
Guest User

Untitled

a guest
Mar 26th, 2015
237
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 6.10 KB | None | 0 0
  1. <?php $meta = get_post_custom($post->ID); ?>
  2.  
  3. <?php if ( has_post_format( 'audio' ) ): // Audio ?>
  4.  
  5.     <?php $formats = array();
  6.         foreach ( explode('|','mp3|ogg') as $format ) {
  7.             if ( isset($meta['_audio_'.$format.'_url']) ) {
  8.                 $format = ($format=='ogg')?'oga':$format;
  9.                 // Change mp3 to m4a if necessary
  10.                 if ( $format == 'mp3' ) {
  11.                     if ( strstr($meta['_audio_mp3_url'][0],'.m4a') ) {
  12.                         $format = 'm4a';
  13.                     }
  14.                 }
  15.                 $formats[] = $format;
  16.             }
  17.         }
  18.     ?>
  19.  
  20.     <?php if ( !empty($formats) ): ?>
  21.     <script type="text/javascript">
  22.     jQuery(document).ready(function(){
  23.         if(jQuery().jPlayer) {
  24.             jQuery("#jquery-jplayer-<?php the_ID(); ?>").jPlayer({
  25.                 ready: function () {
  26.                     jQuery(this).jPlayer("setMedia", {
  27.                         <?php if(in_array('mp3',$formats)) { echo 'mp3: "'.$meta['_audio_mp3_url'][0].'",'."\n"; } ?>
  28.                         <?php if(in_array('m4a',$formats)) { echo 'm4a: "'.$meta['_audio_mp3_url'][0].'",'."\n"; } ?>
  29.                         <?php if(in_array('oga',$formats)) { echo 'oga: "'.$meta['_audio_ogg_url'][0].'",'."\n"; } ?>
  30.                     });
  31.                 },
  32.                 swfPath: "<?php echo get_template_directory_uri() ?>/js",
  33.                 cssSelectorAncestor: "#jp-interface-<?php the_ID(); ?>",
  34.                 supplied: "<?php echo implode(',',$formats); ?>"
  35.             });
  36.         }
  37.     });
  38.     </script>
  39.     <?php endif; ?>
  40.  
  41.     <div class="post-format">
  42.         <div class="image-container">
  43.             <?php if ( has_post_thumbnail() ) {
  44.                 the_post_thumbnail('thumb-large');
  45.                 $caption = get_post(get_post_thumbnail_id())->post_excerpt;
  46.                 if ( isset($caption) && $caption ) echo '<div class="image-caption">'.$caption.'</div>';
  47.             } ?>
  48.         </div>
  49.  
  50.         <div id="jquery-jplayer-<?php the_ID(); ?>" class="jp-jplayer"></div>
  51.  
  52.         <div class="jp-audio">
  53.             <div id="jp-interface-<?php the_ID(); ?>" class="jp-interface">
  54.                 <ul class="jp-controls">
  55.                     <li><a href="#" class="jp-play" tabindex="1"><i class="fa fa-play"></i></a></li>
  56.                     <li><a href="#" class="jp-pause" tabindex="1"><i class="fa fa-pause"></i></a></li>
  57.                     <li><a href="#" class="jp-mute" tabindex="1"><i class="fa fa-volume-up"></i></a></li>
  58.                     <li><a href="#" class="jp-unmute" tabindex="1"><i class="fa fa-volume-down"></i></a></li>
  59.                 </ul>
  60.                 <div class="jp-progress-container">
  61.                     <div class="jp-progress">
  62.                         <div class="jp-seek-bar">
  63.                             <div class="jp-play-bar"></div>
  64.                         </div>
  65.                     </div>
  66.                 </div>
  67.                 <div class="jp-volume-bar-container">
  68.                     <div class="jp-volume-bar">
  69.                         <div class="jp-volume-bar-value"></div>
  70.                     </div>
  71.                 </div>
  72.             </div>
  73.         </div>
  74.  
  75.     </div>
  76.  
  77. <?php endif; ?>
  78.  
  79. <?php if ( has_post_format( 'gallery' ) ): // Gallery ?>
  80.  
  81.     <div class="post-format">
  82.         <?php $images = alx_post_images(); if ( !empty($images) ): ?>
  83.         <script type="text/javascript">
  84.             // Check if first slider image is loaded, and load flexslider on document ready
  85.             jQuery(document).ready(function(){
  86.              var firstImage = jQuery('#flexslider-<?php echo the_ID(); ?>').find('img').filter(':first'),
  87.                 checkforloaded = setInterval(function() {
  88.                     var image = firstImage.get(0);
  89.                     if (image.complete || image.readyState == 'complete' || image.readyState == 4) {
  90.                         clearInterval(checkforloaded);
  91.                         jQuery('#flexslider-<?php echo the_ID(); ?>').flexslider({
  92.                             animation: "fade",
  93.                             slideshow: true,
  94.                             directionNav: true,
  95.                             controlNav: true,
  96.                             pauseOnHover: true,
  97.                             slideshowSpeed: 7000,
  98.                             animationSpeed: 600,
  99.                             smoothHeight: true,
  100.                             touch: false
  101.                         });
  102.                     }
  103.                 }, 20);
  104.             });
  105.         </script>
  106.         <div class="flex-container">
  107.             <div class="flexslider" id="flexslider-<?php the_ID(); ?>">
  108.                 <ul class="slides">
  109.                     <?php foreach ( $images as $image ): ?>
  110.                         <li>
  111.                             <?php $imageid = wp_get_attachment_image_src($image->ID,'large'); ?>
  112.                             <img src="<?php echo $imageid[0]; ?>" alt="<?php echo $image->post_title; ?>">
  113.  
  114.                             <?php if ( $image->post_excerpt ): ?>
  115.                                 <div class="image-caption"><?php echo $image->post_excerpt; ?></div>
  116.                             <?php endif; ?>
  117.                         </li>
  118.                     <?php endforeach; ?>
  119.                 </ul>
  120.             </div>
  121.         </div>
  122.         <?php endif; ?>
  123.     </div>
  124.  
  125. <?php endif; ?>
  126.  
  127. <?php if ( has_post_format( 'image' ) ): // Image ?>
  128.  
  129.     <div class="post-format">
  130.         <div class="image-container">
  131.             <?php if ( has_post_thumbnail() ) {
  132.                 the_post_thumbnail('thumb-large');
  133.                 $caption = get_post(get_post_thumbnail_id())->post_excerpt;
  134.                 if ( isset($caption) && $caption ) echo '<div class="image-caption">'.$caption.'</div>';
  135.             } ?>
  136.         </div>
  137.     </div>
  138.  
  139. <?php endif; ?>
  140.  
  141. <?php if ( has_post_format( 'video' ) ): // Video ?>
  142.  
  143.     <div class="post-format">
  144.         <?php
  145.             if ( isset($meta['_video_url'][0]) && !empty($meta['_video_url'][0]) ) {
  146.                 global $wp_embed;
  147.                 $video = $wp_embed->run_shortcode('[embed]'.$meta['_video_url'][0].'[/embed]');
  148.                 echo $video;
  149.             } elseif ( isset($meta['_video_embed_code'][0]) && !empty($meta['_video_embed_code'][0]) ) {
  150.                 echo '<div class="video-container">';
  151.                 echo $meta['_video_embed_code'][0];
  152.                 echo '</div>';
  153.             }
  154.         ?>
  155.     </div>
  156.  
  157. <?php endif; ?>
  158.  
  159. <?php if ( has_post_format( 'quote' ) ): // Quote ?>
  160.  
  161.     <div class="post-format">
  162.         <div class="format-container pad">
  163.             <i class="fa fa-quote-right"></i>
  164.             <blockquote><?php echo isset($meta['_quote'][0])?wpautop($meta['_quote'][0]):''; ?></blockquote>
  165.             <p class="quote-author"><?php echo (isset($meta['_quote_author'][0])?'&mdash; '.$meta['_quote_author'][0]:''); ?></p>
  166.         </div>
  167.     </div>
  168.  
  169. <?php endif; ?>
  170.  
  171. <?php if ( has_post_format( 'chat' ) ): // Chat ?>
  172.  
  173.     <div class="post-format">
  174.         <div class="format-container pad">
  175.             <i class="fa fa-comments-o"></i>
  176.             <blockquote>
  177.                 <?php echo (isset($meta['_chat'][0])?wpautop($meta['_chat'][0]):''); ?>
  178.             </blockquote>
  179.         </div>
  180.     </div>
  181.  
  182. <?php endif; ?>
  183.  
  184. <?php if ( has_post_format( 'link' ) ): // Link ?>
  185.  
  186.     <div class="post-format">
  187.         <div class="format-container pad">
  188.             <p><a href="<?php echo (isset($meta['_link_url'][0])?$meta['_link_url'][0]:'#'); ?>">
  189.                 <i class="fa fa-link"></i>
  190.                 <?php echo (isset($meta['_link_title'][0])?$meta['_link_title'][0]:get_the_title()); ?> &rarr;
  191.             </a></p>
  192.         </div>
  193.     </div>
  194.  
  195. <?php endif; ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement