webriti

Spasalon Call Full size image in slider

Jun 26th, 2016
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.09 KB | None | 0 0
  1. <?php
  2. $current_options = wp_parse_args( get_option( 'spa_theme_options', array() ), default_data() );
  3. $call_us = $current_options['call_us'];
  4. $slider_entries_main = $current_options['slider_entries_main'];
  5. $slider_bannerstrip_enable = $current_options['slider_bannerstrip_enable'];
  6.  
  7. $args = array( 'post_type' => 'spa_slider', 'posts_per_page'=>$slider_entries_main );
  8. $loop = new WP_Query( $args );
  9. ?>
  10. <!-- Slider with Thumbnails -->
  11. <div id="main" role="main">
  12. <section class="slider">
  13. <div id="slider" class="flexslider">
  14. <ul class="slides">
  15. <?php
  16.  
  17. if( $loop->have_posts() ):
  18.  
  19. while ( $loop->have_posts() ) : $loop->the_post();
  20.  
  21. $my_meta = get_post_meta( $post->ID ,'_my_meta', TRUE );
  22.  
  23. if(isset($my_meta['link']))
  24. { $meta_value_link = $my_meta['link']; }
  25. else
  26. { $meta_value_link = get_permalink(); }
  27.  
  28. if(isset($my_meta['check']))
  29. { $target ='target="_blank"'; } else { $target ='target="_self"'; }
  30. ?>
  31. <li>
  32. <?php
  33. if( has_post_thumbnail() ):
  34. $title = get_post( get_post_thumbnail_id() )->post_title;
  35. $large_image_url = wp_get_attachment_image_src( get_post_thumbnail_id(),'full' );
  36. $alt_text = get_post_meta( get_post_thumbnail_id() , '_wp_attachment_image_alt', true);
  37. ?>
  38. <a href="<?php echo $meta_value_link ; ?>" <?php echo $target; ?> >
  39. <img alt="<?php echo $alt_text ?>" src="<?php echo $large_image_url[0]; ?>" title="<?php echo $title ?>"/>
  40. </a>
  41. <?php endif; ?>
  42.  
  43. <?php if( $slider_bannerstrip_enable == 'yes' && isset($my_meta['banner_enable']) == true ): ?>
  44. <div class="container topbar-detail">
  45. <div class="col-md-3">
  46. <div class="title">
  47. <h4><?php if( isset( $my_meta['heading_one'] ) ){ echo $my_meta['heading_one']; } ?></h4>
  48. <h1><?php if( isset( $my_meta['heading_two'] ) ){ echo $my_meta['heading_two']; } ?></h1>
  49. </div>
  50. </div>
  51. <div class="col-md-6">
  52. <p class="description">
  53. <?php if( isset( $my_meta['banner_description'] ) ){ echo $my_meta['banner_description']; } ?>
  54. </p>
  55. </div>
  56. <div class="col-md-3"><div class="addr-detail"><address><?php echo $current_options['call_us_text']; ?> <strong><?php echo $call_us; ?></strong></address></div></div>
  57. </div>
  58. <?php endif; ?>
  59. </li>
  60. <?php
  61. endwhile;
  62.  
  63. else :
  64.  
  65. for( $i=1; $i<=8; $i++){
  66.  
  67. echo ' <li>
  68. <img alt="img" src="'.(get_template_directory_uri()).'/images/default/image_2000x800.jpg" />
  69. <div class="container topbar-detail">
  70. <div class="col-md-3"><div class="title"><h4>Get Yourself</h4><h1>Refreshed</h1></div></div>
  71. <div class="col-md-6"><p class="description">Donec justo odio, lobortis eget congue sed, rutrum sit amet mauris. Curabitur sed lectus nulla. Curabitur sed lectus nulla.lobortis eget congue sed, rutrum sit amet mauris. Curabitur sed lectus nulla rutrum sit amet mauris</p></div>
  72. <div class="col-md-3"><div class="addr-detail"><address>CALL US ON <strong>201 567 8978</strong></address></div></div>
  73. </div>
  74. </li>';
  75.  
  76. }
  77.  
  78. endif;
  79. ?>
  80. </ul>
  81. </div>
  82.  
  83. <?php
  84. if( $current_options['slider_thumbnails_enable'] == 'yes' ) :
  85.  
  86. $loop2 = new WP_Query ( array('post_type' => 'spa_slider', 'posts_per_page'=>$slider_entries_main ));
  87. ?>
  88. <div class="container thumb-caption-detail">
  89. <div class="row">
  90. <div id="carousel" class="flexslider">
  91. <ul class="slides">
  92. <?php
  93. if( $loop2->have_posts() ):
  94.  
  95. while ( $loop2->have_posts() ) : $loop2->the_post();
  96.  
  97. $my_meta = get_post_meta($post->ID, '_my_meta', TRUE);
  98. ?>
  99. <li>
  100. <?php
  101. if( has_post_thumbnail() ):
  102.  
  103. $title = get_post(get_post_thumbnail_id())->post_title;
  104.  
  105. $thumb_bread_image_url = wp_get_attachment_image_src( get_post_thumbnail_id(),'full');
  106.  
  107. $alt_text = get_post_meta(get_post_thumbnail_id(), '_wp_attachment_image_alt', true);
  108. ?>
  109. <img alt="<?php echo $alt_text ?>" src="<?php echo $thumb_bread_image_url[0]; ?>" title="<?php echo $title; ?>" />
  110. <?php endif; ?>
  111.  
  112. <div class="thumb-caption">
  113. <span>
  114. <?php if( isset( $my_meta['heading_one'] ) )
  115. { echo $my_meta['heading_one']; }
  116. ?>
  117. <h4>
  118. <?php if( isset( $my_meta['heading_two'] ))
  119. { echo $my_meta['heading_two']; }
  120. ?>
  121. </h4></span>
  122. <?php
  123. if( isset( $my_meta['link'] ) )
  124. { $meta_value_link = $my_meta['link']; }
  125. else
  126. { $meta_value_link = get_permalink(); }
  127.  
  128. if( isset( $my_meta['check'] ) )
  129. { $target ='target="_blank"'; } else { $target ='target="_self"'; }
  130. ?>
  131. <a href="<?php echo $meta_value_link; ?>" <?php echo $target; ?> class="thumb-btn"><?php _e("Explore More",'spasalon');?> </a>
  132. </div>
  133. </li>
  134. <?php
  135. endwhile;
  136. else:
  137.  
  138. for( $i=1; $i<=8; $i++){
  139.  
  140. echo '<li><img alt="img" src="'.(get_template_directory_uri()).'/images/default/image_2000x800.jpg" />
  141. <div class="thumb-caption">
  142. <span>PRODUCING<h4>QUALITY</h4></span>
  143. <a href="#" class="thumb-btn">Explore More </a>
  144. </div>
  145. </li>';
  146.  
  147. }
  148.  
  149. endif;
  150. ?>
  151. </ul>
  152. </div>
  153. </div>
  154. </div>
  155. <?php endif; ?>
  156.  
  157. </section>
  158. </div>
  159. <!-- End of Slider with Thumbnails -->
  160. <script>
  161. jQuery('#slider').flexslider({
  162. animation: "<?php echo $current_options['slide_effect_main']; ?>",
  163. controlNav: false,
  164. animationLoop: false,
  165. slideshow: true,
  166. slideshowSpeed: <?php echo $current_options['animation_speed_main']; ?>,
  167. animationSpeed: <?php echo $current_options['auto_slide_interval_main']; ?>,
  168. sync: "#carousel",
  169. start: function(slider){
  170. jQuery('body').removeClass('loading');
  171. }
  172. });
  173. </script>
  174.  
  175. <div class="clearfix"></div>
Add Comment
Please, Sign In to add comment