Guest User

Untitled

a guest
Apr 17th, 2018
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.66 KB | None | 0 0
  1. <?php
  2. $rambo_pro_theme_options = theme_data_setup();
  3. $current_options = wp_parse_args( get_option( 'rambo_pro_theme_options', array() ), $rambo_pro_theme_options );
  4. if($current_options['home_slider_enabled']==true)
  5. {
  6. if($current_options['slider_category'] !='')
  7. {
  8. $arg = array( 'post_type'=>'post','category__in' => $current_options['slider_category'],'ignore_sticky_posts' => 1);
  9. $loop = new WP_Query( $arg );
  10. if ( $loop->have_posts() ) :
  11. $t=true;
  12.  
  13. ?>
  14. <script>
  15. jQuery(function() {
  16.  
  17. // Homepage Main Slider Js
  18. jQuery("#slider-carousel").carousel( {
  19. interval:<?php echo $current_options['slider_transition_delay']; ?>,
  20. pause: "hover"
  21. });
  22.  
  23. });
  24. </script>
  25. <div class="main_slider">
  26. <div id="slider-carousel" class="carousel slide <?php echo $current_options['slider_options']; ?>"data-ride="carousel" >
  27. <div class="carousel-inner">
  28. <!-- Carousel items -->
  29. <?php
  30. $slide_count = 0;
  31. while ( $loop->have_posts() ) : $loop->the_post(); ?>
  32.  
  33. <div id="post-<?php the_ID(); ?>" class="item <?php if( $t == true ){ echo 'active'; } $t = false; ?>" >
  34. <?php
  35. $btn_enable = sanitize_text_field( get_post_meta( get_the_ID(), 'btn_enable', true ));
  36. $btn_text = sanitize_text_field( get_post_meta( get_the_ID(), 'btn_text', true ));
  37. $btn_link = sanitize_text_field( get_post_meta( get_the_ID(), 'btn_link', true ));
  38. $btn_target = sanitize_text_field( get_post_meta( get_the_ID(), 'btn_target', true ));
  39.  
  40. $default_arg =array('class' => "img-responsive");
  41. if(has_post_thumbnail()){ the_post_thumbnail('', $default_arg); }
  42. ?>
  43. <div class="container slider_con">
  44. <h2><?php echo the_title(); ?></h2>
  45.  
  46. <?php if( has_excerpt() ): ?>
  47. <h5 class="slide-title"><span><?php echo get_the_excerpt(); ?></span></h5>
  48. <?php endif;
  49. if($btn_enable):
  50. ?>
  51. <a class="slide-btn" href="<?php echo $btn_link; ?>" <?php if( $btn_target) echo 'target="_blank"'; ?>><?php echo $btn_text; ?></a>
  52. <?php endif; ?>
  53. </div>
  54.  
  55. </div>
  56.  
  57. <?php
  58. $slide_count = $slide_count+1;
  59. endwhile;
  60. ?>
  61. </div>
  62.  
  63.  
  64.  
  65. <?php if($slide_count > 1) {?>
  66. <!-- Carousel nav -->
  67. <ul class="carou-direction-nav">
  68. <li><a class="carou-prev" href="#slider-carousel" data-slide="prev"></a></li>
  69. <li><a class="carou-next" href="#slider-carousel" data-slide="next"></a></li>
  70. </ul>
  71. <?php } ?>
  72.  
  73.  
  74. </div>
  75. </div>
  76. <?php endif; }
  77. else {
  78. $current_options = get_option( 'rambo_pro_theme_options');
  79. if(!empty($current_options)){
  80. get_template_part('index','sliderold');
  81. }}
  82. }
  83. ?>
  84. <!-- /End of Slider -->
  85. <!-- /Slider -->
Add Comment
Please, Sign In to add comment