SHARE
TWEET

home-slider.php

a guest Aug 16th, 2016 19 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. $wl_theme_options = weblizar_slideshow_options();
  3. $autoPlay= $wl_theme_options['home_slider_auto_play']=="on" ? 1 : 0; ?>
  4. <script>
  5. jQuery.Slitslider.defaults = {
  6.     // transitions speed
  7.     speed : <?php echo $wl_theme_options['home_slide_show_speed'];?>,
  8.     // if true the item's slices will also animate the opacity value
  9.     optOpacity : false,
  10.     // amount (%) to translate both slices - adjust as necessary
  11.     translateFactor : 230,
  12.     // maximum possible angle
  13.     maxAngle : 25,
  14.     // maximum possible scale
  15.     maxScale : 2,
  16.     // slideshow on / off
  17.     autoplay : <?php echo $autoPlay; ?>,
  18.     // keyboard navigation
  19.     keyboard : true,
  20.     // time between transitions
  21.     interval : <?php echo $wl_theme_options['home_slideshow_interval'];?>,
  22.     // callbacks
  23.     onBeforeChange : function( slide, idx ) {
  24.         return false;
  25.     },
  26.     onAfterChange : function( slide, idx ) {
  27.         return false;
  28.     }
  29. };
  30. </script>
  31. <div id="slider" class="sl-slider-wrapper tp-banner-container">
  32.     <div class="sl-slider fullwidthbanner rslider tp-banner"><?php
  33.         $args = array('post_type' => 'creative_slider','posts_per_page'=> -1 );
  34.         $f_query = new WP_Query($args);
  35.         if($f_query->have_posts()){
  36.             $i=1;
  37.             while ($f_query->have_posts()) : $f_query->the_post();
  38.             if ($i % 2 == 0){ $orientation = 'horizontal';  }
  39.             else { $orientation = 'vertical'; } ?>
  40.             <div class="sl-slide" autoplay="true" data-orientation="<?php echo $orientation; ?>" data-slice1-rotation="-25" data-slice2-rotation="-25" data-slice1-scale="2" data-slice2-scale="2">
  41.                 <div class="sl-slide-inner">
  42.                     <?php if(has_post_thumbnail()): ?>
  43.                     <?php $defalt_arg =array('class' => "bg-img creative-img-responsive");                        
  44.                     the_post_thumbnail('',$defalt_arg); ?>
  45.                     <?php endif; ?>                
  46.                     <h2><?php echo the_title(); ?></h2>
  47.                     <blockquote><p><?php echo wp_trim_words(esc_attr(get_post_meta( get_the_ID(), 'slider_description', true )),10,''); ?></p>
  48.                     <?php if(get_post_meta( get_the_ID(), 'slider_btn_text', true )){ ?>
  49.                     <a href="<?php echo esc_attr(get_post_meta(get_the_ID(),'slider_link','true')); ?>" <?php if(get_post_meta(get_the_ID(),'newtab',true)){ echo "target='_blank'"; } ?> >
  50.                     <cite class="slider-button"><?php echo esc_attr(get_post_meta( get_the_ID(), 'slider_btn_text', true )); ?></cite></blockquote>
  51.                     </a>
  52.                     <?php } ?>
  53.                 </div>
  54.             </div><?php $i++;
  55.           endwhile;
  56.         }else{ ?>
  57.         <div class="sl-slide" autoplay="true" data-orientation="vertical" data-slice1-rotation="10" data-slice2-rotation="-15" data-slice1-scale="1.5" data-slice2-scale="1.5">
  58.             <div class="sl-slide-inner">
  59.                 <img src="<?php echo esc_url(get_template_directory_uri()); ?>/img/slider/2.jpg" class="bg-img" alt="Creative_Image" />
  60.                 <h2><?php _e('Regula aurea.', 'creative'); ?></h2>
  61.                 <blockquote><p><?php _e('Until he extends the circle of his compassion to all living things, man will not himself find peace.','creative'); ?></p><cite><?php _e('Albert Schweitzer', 'creative'); ?></cite></blockquote>
  62.             </div>
  63.         </div>
  64.        
  65.         <?php } ?>
  66.     </div><!-- /sl-slider -->
  67.     <nav id="nav-arrows" class="nav-arrows">
  68.         <span class="nav-arrow-prev">Previous</span>
  69.         <span class="nav-arrow-next">Next</span>
  70.     </nav>
  71.     <nav id="nav-dots" class="nav-dots"><?php
  72.         if($f_query->post_count > 0 ){
  73.             for($i=0;$i<$f_query->post_count;$i++){ ?>
  74.                 <span <?php echo $i==0 ? 'class="nav-dot-current"' : ""; ?>></span> <?php
  75.             }
  76.         }else{
  77.             for($i=0; $i<3; $i++) { ?>
  78.                 <span <?php echo $i==0 ? 'class="nav-dot-current"' : ""; ?>></span><?php
  79.             }
  80.         } ?>
  81.     </nav>
  82. </div><!-- /slider-wrapper -->
  83. <?php //} ?>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top