Advertisement
Guest User

Untitled

a guest
Jun 30th, 2021
23
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /**
  2. * slider section for the homepage.
  3. */
  4. if (!function_exists('appointment_slider')) :
  5.  
  6. function appointment_slider() {
  7.  
  8. $appointment_options = appointment_theme_setup_data();
  9. $slider_setting = wp_parse_args(get_option('appointment_options', array()), $appointment_options);
  10. if ($slider_setting['home_banner_enabled'] == 0) {
  11. $theme = wp_get_theme();
  12. if('Appointee'==$theme->name){
  13. $slider_class=' slider2';
  14. }
  15.  
  16. ?>
  17. <div class="homepage-mycarousel <?php echo $slider_setting['slider_radio']; echo (isset($slider_class)) ? $slider_class : ''; ?>">
  18. <div id="carousel-example-generic" class="carousel slide <?php echo esc_attr($slider_setting['slider_options']); ?>" data-ride="carousel" <?php if ($slider_setting['slider_transition_delay'] != '') { ?> data-interval="<?php
  19. echo esc_attr($slider_setting['slider_transition_delay']);
  20. }
  21. ?>" >
  22. <!-- Indicators -->
  23. <?php
  24. $query_args = array();
  25. if ($slider_setting['slider_radio'] == 'demo') {
  26.  
  27. if($theme->name =='Appointment Dark'){
  28. $demo_slide1=WC__PLUGIN_URL . 'inc/appointment/images/slider/appointment-dark-slide1.jpg';
  29. $demo_slide2=WC__PLUGIN_URL . 'inc/appointment/images/slider/appointment-dark-slide2.jpg';
  30. $demo_slide3=WC__PLUGIN_URL . 'inc/appointment/images/slider/appointment-dark-slide3.jpg';
  31. }elseif($theme->name =='Appointee'){
  32. $demo_slide1=WC__PLUGIN_URL . 'inc/appointment/images/slider/appointee-slide1.jpg';
  33. $demo_slide2=WC__PLUGIN_URL . 'inc/appointment/images/slider/appointee-slide2.jpg';
  34. $demo_slide3=WC__PLUGIN_URL . 'inc/appointment/images/slider/appointee-slide3.jpg';
  35. }else{
  36. $demo_slide1=WC__PLUGIN_URL . 'inc/appointment/images/slider/slide1.jpg';
  37. $demo_slide2=WC__PLUGIN_URL . 'inc/appointment/images/slider/slide2.jpg';
  38. $demo_slide3=WC__PLUGIN_URL . 'inc/appointment/images/slider/slide3.jpg';
  39. }
  40. ?>
  41. <ol class="carousel-indicators" role="tablist" tabindex="0">
  42. <li data-target="#carousel-example-generic" data-slide-to="0" class="active"></li>
  43. <li data-target="#carousel-example-generic" data-slide-to="1"></li>
  44. <li data-target="#carousel-example-generic" data-slide-to="2"></li>
  45. </ol>
  46. <div class="carousel-inner" role="listbox">
  47. <div class="item active" >
  48. <img src="<?php echo esc_url($demo_slide1); ?>" alt="<?php esc_attr_e('image1', 'webriti-companion'); ?>">
  49. <div class="container slide-caption">
  50. <div class="slide-text-bg1"><h2><?php echo esc_html__('Donec Maximus Rhoncus', 'webriti-companion'); ?></h2></div>
  51. <div class="slide-text-bg2"><span><?php echo esc_html__('In neque ex, euismod sed sagittis et, ultrices vel diam. Donec vel mattis enim vel ipsum mattis fringilla.', 'webriti-companion'); ?></span></div>
  52. <div class="slide-btn-area-sm"><a href="#" class="slide-btn-sm"><?php echo esc_html__('Velit Quis', 'webriti-companion'); ?></a></div>
  53. </div>
  54. </div>
  55. <div class="item" >
  56. <img src="<?php echo esc_url($demo_slide2); ?>" alt="<?php esc_attr_e('image2', 'webriti-companion'); ?>">
  57. <div class="container slide-caption">
  58. <div class="slide-text-bg1"><h2><?php echo esc_html__('Donec Maximus Rhoncus', 'webriti-companion'); ?></h2></div>
  59. <div class="slide-text-bg2"><span><?php echo esc_html__('In neque ex, euismod sed sagittis et, ultrices vel diam. Donec vel mattis enim vel ipsum mattis fringilla.', 'webriti-companion'); ?></span></div>
  60. <div class="slide-btn-area-sm"><a href="#" class="slide-btn-sm"><?php echo esc_html__('Velit Quis', 'webriti-companion'); ?></a></div>
  61. </div>
  62. </div>
  63. <div class="item" >
  64. <img src="<?php echo esc_url($demo_slide3); ?>" alt="<?php esc_attr_e('image3', 'webriti-companion'); ?>">
  65. <div class="container slide-caption">
  66. <div class="slide-text-bg1"><h2><?php echo esc_html__('Donec Maximus Rhoncus', 'webriti-companion'); ?></h2></div>
  67. <div class="slide-text-bg2"><span><?php echo esc_html__('In neque ex, euismod sed sagittis et, ultrices vel diam. Donec vel mattis enim vel ipsum mattis fringilla.', 'webriti-companion'); ?></span></div>
  68. <div class="slide-btn-area-sm"><a href="#" class="slide-btn-sm"><?php echo esc_html__('Velit Quis', 'webriti-companion'); ?></a></div>
  69. </div>
  70. </div>
  71. </div>
  72. <!-- Controls -->
  73. <ul class="carou-direction-nav">
  74. <li><a class="carou-prev" href="#carousel-example-generic" data-slide="prev"></a></li>
  75. <li><a class="carou-next" href="#carousel-example-generic" data-slide="next"></a></li>
  76. </ul>
  77. <?php
  78. } else {
  79. $featured_slider_post = $slider_setting['featured_slider_post'];
  80.  
  81. $slider_select_category = array();
  82.  
  83. if (!is_array($slider_setting['slider_select_category'])) {
  84. $slider_select_category = explode(',', $slider_setting['slider_select_category']);
  85. } else {
  86. $slider_select_category = $slider_setting['slider_select_category'];
  87. }
  88.  
  89. $query_args = array('category__in' => $slider_select_category, 'ignore_sticky_posts' => 1, 'posts_per_page' => $featured_slider_post);
  90.  
  91. $t = true;
  92.  
  93. $the_query = new WP_Query($query_args);
  94. $i = 0;
  95. if ($the_query->post_count > 1):
  96. ?>
  97. <ol class="carousel-indicators" role="tablist" tabindex="0">
  98. <?php
  99. if ($the_query->have_posts()) {
  100. while ($the_query->have_posts()) {
  101. $the_query->the_post();
  102. ?>
  103. <li data-target="#carousel-example-generic" data-slide-to="<?php echo absint($i); ?>" class="<?php
  104. if ($i == 0) {
  105. echo 'active';
  106. }
  107. ?>"></li>
  108. <?php
  109. $i++;
  110. }
  111. }
  112. ?>
  113. </ol>
  114. <?php endif; ?>
  115.  
  116. <div class="carousel-inner" role="listbox">
  117. <?php
  118. //echo '<pre>';print_r($the_query); wp_die();
  119. if ($the_query->have_posts()) {
  120. while ($the_query->have_posts()) {
  121. $the_query->the_post();
  122. ?>
  123. <div class="item <?php
  124. if ($t == true) {
  125. echo 'active';
  126. }$t = false;
  127. ?>">
  128. <?php $default_arg = array('class' => "img-responsive"); ?>
  129. <?php
  130. if (has_post_thumbnail()) {
  131. the_post_thumbnail('', $default_arg);
  132. }
  133. if (!has_post_thumbnail()) {
  134. ?>
  135. <img class="img-responsive" src="<?php echo esc_url(WC__PLUGIN_URL . 'inc/appointment/images/slider/no-image.jpg'); ?>">
  136.  
  137. <div class="container slide-caption">
  138.  
  139. <?php if ($the_query->post_title == "") { ?>
  140. <div class="slide-text-bg1"><h2><?php the_title(); ?></h2></div>
  141.  
  142. <?php
  143. }
  144. if ($the_query->post_content == "") {?>
  145. <div class="slide-text-bg2">
  146. <span>
  147. <?php echo the_content(); ?>
  148. </span>
  149. </div>
  150. <?php } ?>
  151.  
  152. </div>
  153. <?php } else {
  154. ?>
  155. <div class="container slide-caption">
  156. <?php if ($the_query->post_title == "") { ?>
  157. <div class="slide-text-bg1"><h2><?php the_title(); ?></h2></div>
  158.  
  159. <?php
  160. }
  161. if ($the_query->post_content == "") { ?>
  162. <div class="slide-text-bg2">
  163. <span>
  164. <?php echo the_content(); ?>
  165. </span>
  166. </div>
  167. <?php } ?>
  168.  
  169.  
  170.  
  171. </div>
  172. <?php } ?>
  173. </div>
  174. <?php
  175. } wp_reset_postdata();
  176. }
  177. ?>
  178.  
  179. </div>
  180. <!-- Pagination -->
  181. <?php if ($i > 1) { ?>
  182. <!-- Controls -->
  183. <ul class="carou-direction-nav">
  184. <li><a class="carou-prev" href="#carousel-example-generic" data-slide="prev"></a></li>
  185. <li><a class="carou-next" href="#carousel-example-generic" data-slide="next"></a></li>
  186. </ul>
  187. <?php } ?>
  188. <!-- /Pagination -->
  189. </div>
  190. <!-- /Slider Section -->
  191. <?php
  192. }
  193. ?>
  194. </div>
  195. <div class="clearfix"></div>
  196. <?php
  197. }
  198. }
  199.  
  200. endif;
  201.  
  202. if (function_exists('appointment_slider')) {
  203. $section_priority = apply_filters('appointment_section_priority', 20, 'appointment_slider');
  204. add_action('appointment_sections', 'appointment_slider', absint($section_priority));
  205. }
Advertisement
RAW Paste Data Copied
Advertisement