Advertisement
jegtheme

template-slider-gallery.php

Aug 5th, 2016
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.20 KB | None | 0 0
  1. <?php
  2. /**
  3.  * Template Name: Slider - Gallery
  4.  */
  5.  
  6. get_header();
  7.  
  8. if ( ! post_password_required() )
  9. {
  10.     ?>
  11.     <div class="headermenu">
  12.         <?php get_template_part('fragment/header-search-bar'); ?>
  13.     </div> <!-- headermenu -->
  14.  
  15.     <div class="fs-container">
  16.         <div class="slideshowgallery" style='opacity: 0;' data-loop="true" data-autoplay="<?php echo esc_attr ( vp_metabox('photology_slider_gallery.toggle_autoplay') === "1" ? vp_metabox('photology_slider_gallery.autoplay_delay') : false ); ?>">
  17.             <?php
  18.             $mediagallery = get_post_meta(get_the_ID(), 'postgallery', true);
  19.             if($mediagallery)
  20.             {
  21.                 foreach ($mediagallery as $key => $value)
  22.                 {
  23.                     if($value['type'] === 'image')
  24.                     {
  25.                         $image = jeg_get_image_attachment_full($value['imageid']);
  26.                         $thumbnail = apply_filters('jeg_image_resizer',$image, 144, false);
  27.                         echo "<a href='" . esc_url( $image ) . " '><img src='" . esc_url( $thumbnail) . "' height='96'></a>";
  28.                     } else if($value['type'] === 'youtube' || $value['type'] === 'vimeo')
  29.                     {
  30.                         $mediaurl = $value['mediaurl'];
  31.                         $image = jeg_get_image_attachment_full($value['mediacover']);
  32.                         $thumbnail = apply_filters('jeg_image_resizer', $image, 144, false);
  33.                         echo "<a href='" . esc_url($mediaurl ) . "' data-img='" . esc_attr($image ) . "'><img src='" . esc_url($thumbnail ) . "' height='96'></a>";
  34.                     }
  35.                 }
  36.             }
  37.             ?>
  38.         </div>
  39.     </div>
  40.     <div class="sliderloader bigloader"></div>
  41.  
  42.     <script>
  43.         (function($){
  44.             $(document).ready(function(){
  45.                 /** Full screen **/
  46.                 if($(".fs-container").length) {
  47.                     $(".fs-container").fsfullheight(['.headermenu', '.responsiveheader', '.topnavigation']);
  48.                 }
  49.  
  50.                 /** Fullscreen Fotorama **/
  51.                 $(".slideshowgallery").fotorama({
  52.                     allowfullscreen: false,
  53.                     arrows: <?php echo esc_js ( vp_metabox('photology_slider_gallery.show_arrow') === "1" ? "true" : "false" ); ?>,
  54.                     width: '100%',
  55.                     maxWidth: '100%',
  56.                     height : '100%',
  57.                     minheight : '100%',
  58.                     maxheight : '100%',
  59.                     nav: "<?php echo esc_js ( vp_metabox('photology_slider_gallery.show_thumb') === "1" ? "thumbs" : "false" );  ?>",
  60.                     fit : "<?php echo esc_js ( vp_metabox('photology_slider_gallery.fit_mode') ) ?>"
  61.                 });
  62.  
  63.                 $(".slideshowgallery").on('fotorama:load', function(){});
  64.  
  65.                 $(window).load(function(){
  66.                     $(".slideshowgallery").animate({
  67.                         'opacity' : 1
  68.                     }, 300);
  69.                     $(".sliderloader").fadeOut();
  70.                 });
  71.             });
  72.         })(jQuery);
  73.     </script>
  74.  
  75. <?php
  76. } else {
  77.     get_template_part('fragment/password-form');
  78. }
  79. get_footer();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement