Guest User

Untitled

a guest
Feb 10th, 2020
44
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 11.33 KB | None | 0 0
  1. <?php
  2. $current_options = wp_parse_args( get_option( 'spa_theme_options', array() ), default_data() );
  3.  
  4. if( $current_options['service_hide'] != false ):
  5.  
  6. $spasalon_service_content = ! empty($current_options['spasalon_service_content']) ? $current_options['spasalon_service_content'] : '';
  7.  
  8. //$spasalon_service_content = get_option( 'spa_theme_options')['spasalon_service_content'];
  9.  
  10. if(empty($spasalon_service_content))
  11. {
  12. $ThemeData = get_option('spa_theme_options');
  13.  
  14. if (!empty($current_options['slider_cat'])){
  15.  
  16. // Run this code section if user comes form pro old.
  17. //$ServiceOldData = get_option('widget_wbr_feature_page_widget');
  18. //if(sizeof($ServiceOldData)>1){
  19.  
  20. $ServiceOldData = get_option('widget_wbr_feature_page_widget');
  21.  
  22. $the_sidebars = wp_get_sidebars_widgets();
  23.  
  24.  
  25. if(!empty($the_sidebars['sidebar-service'])){
  26.  
  27. $pro_service_data = array();
  28. foreach ($the_sidebars['sidebar-service'] as $data) {
  29.  
  30. $widget_data = explode('-',$data);
  31. $data = $widget_data[1];
  32. if($widget_data[0] == 'wbr_feature_page_widget'){
  33. $options = get_option( 'widget_wbr_feature_page_widget' );
  34.  
  35. $pro_service_data[] = array(
  36. 'icon_value' => isset($options[$widget_data[1]]['icon'])? $options[$widget_data[1]]['icon'] : '',
  37. 'image_url' => isset($options[$widget_data[1]]['selected_page'])? get_the_post_thumbnail_url($options[$widget_data[1]]['selected_page']) :'',
  38. 'title' => isset($options[$widget_data[1]]['selected_page'])? get_the_title( $options[$widget_data[1]]['selected_page'] ) : '',
  39. 'text' => isset($options[$widget_data[1]]['selected_page'])? get_post_field('post_content', $options[$widget_data[1]]['selected_page']) : '',
  40. 'color' => '#f22853',
  41. 'button_text' => isset($options[$widget_data[1]]['buttontext'])? $options[$widget_data[1]]['buttontext'] : '',
  42. 'link' => isset($options[$widget_data[1]]['buttonlink'])? $options[$widget_data[1]]['buttonlink'] : '',
  43. 'choice' => 'customizer_repeater_icon',
  44. 'open_new_tab' => isset($options[$widget_data[1]]['target']) ? $options[$widget_data[1]]['target'] : '',
  45. 'id' => 'customizer_repeater_56d7ea7f40b56',
  46.  
  47. );
  48. }
  49.  
  50. }
  51. $spasalon_service_content = json_encode($pro_service_data);
  52.  
  53. //}
  54.  
  55. }else
  56. {
  57.  
  58. $spasalon_service_content = json_encode( array(
  59. array(
  60. 'icon_value' => 'fa fa-leaf',
  61. 'image_url' => '',
  62. 'title' => esc_html__( 'Spa treatment', 'spasalon' ),
  63. 'text' => 'An veritus voluptatum vim, no duo veritus ocurreret. Stet rebum hendrerit pro an, omnesque salutandi theophrastus ne pri.',
  64. 'color' => '#f22853',
  65. 'choice' => 'customizer_repeater_icon',
  66. 'button_text' => 'Read More',
  67. 'link' => '#',
  68. 'open_new_tab' => 'yes',
  69. 'id' => 'customizer_repeater_56d7ea7f40b56',
  70. ),
  71. array(
  72. 'icon_value' => 'fa fa-street-view',
  73. 'image_url' => '',
  74. 'title' => esc_html__( 'Detox Treatment', 'spasalon' ),
  75. 'text' => 'An veritus voluptatum vim, no duo veritus ocurreret. Stet rebum hendrerit pro an, omnesque salutandi theophrastus ne pri.',
  76. 'color' => '#6dc82b',
  77. 'choice' => 'customizer_repeater_icon',
  78. 'button_text' => 'Read More',
  79. 'link' => '#',
  80. 'open_new_tab' => 'yes',
  81. 'id' => 'customizer_repeater_56d7ea7f40b66',
  82. ),
  83. array(
  84. 'icon_value' => 'fa fa-user',
  85. 'image_url' => '',
  86. 'title' => esc_html__( 'Facial Treatment', 'spasalon' ),
  87. 'text' => 'An veritus voluptatum vim, no duo veritus ocurreret. Stet rebum hendrerit pro an, omnesque salutandi theophrastus ne pri.',
  88. 'color' => '#fe8000',
  89. 'choice' => 'customizer_repeater_icon',
  90. 'button_text' => 'Read More',
  91. 'link' => '#',
  92. 'open_new_tab' => 'yes',
  93. 'id' => 'customizer_repeater_56d7ea7f40b86',
  94. ),
  95. array(
  96. 'icon_value' => 'fa fa-lemon-o',
  97. 'image_url' => '',
  98. 'title' => esc_html__( 'Other Treatments', 'spasalon' ),
  99. 'text' => 'An veritus voluptatum vim, no duo veritus ocurreret. Stet rebum hendrerit pro an, omnesque salutandi theophrastus ne pri.',
  100. 'color' => '#1abac8',
  101. 'choice' => 'customizer_repeater_icon',
  102. 'button_text' => 'Read More',
  103. 'link' => '#',
  104. 'open_new_tab' => 'yes',
  105. 'id' => 'customizer_repeater_56d7ea7f40b86',
  106. ),
  107.  
  108. ) );
  109. }
  110.  
  111.  
  112.  
  113.  
  114. }
  115. }
  116.  
  117. function spasalon_service_content( $spasalon_service_content, $is_callback = false ) {
  118. if ( ! $is_callback ) { ?>
  119. <div class="spasalon-service-content">
  120. <?php
  121. }
  122. if ( ! empty( $spasalon_service_content ) ) {
  123.  
  124. $allowed_html = array(
  125. 'br' => array(),
  126. 'em' => array(),
  127. 'strong' => array(),
  128. 'b' => array(),
  129. 'i' => array(),
  130. );
  131. $spasalon_service_content = json_decode( $spasalon_service_content );
  132. $j=1;
  133. foreach ( $spasalon_service_content as $service_item ) :
  134. $icon = ! empty( $service_item->icon_value ) ? apply_filters( 'spasalon_translate_single_string', $service_item->icon_value, 'service section' ) : '';
  135. $title = ! empty( $service_item->title ) ? apply_filters( 'spasalon_translate_single_string', $service_item->title, 'service section' ) : '';
  136. $text = ! empty( $service_item->text ) ? apply_filters( 'spasalon_translate_single_string', $service_item->text, 'service section' ) : '';
  137. $link = ! empty( $service_item->link ) ? apply_filters( 'spasalon_translate_single_string', $service_item->link, 'service section' ) : '';
  138. $image = ! empty( $service_item->image_url ) ? apply_filters( 'spasalon_translate_single_string', $service_item->image_url, 'service section' ) : '';
  139. $buttontext = ! empty( $service_item->button_text ) ? apply_filters( 'spasalon_translate_single_string', $service_item->button_text, 'service section' ) : '';
  140. $opennewtab = ! empty( $service_item->open_new_tab) ? apply_filters('spasalon_translate_single_string',$service_item->open_new_tab, 'service section' ) : '';
  141.  
  142. $color = '';
  143. if ( is_customize_preview() && ! empty( $service_item->color ) ) {
  144. $color = $service_item->color;
  145. }
  146.  
  147. ?>
  148.  
  149. <div class="col-md-4 col-sm-6 col-xs-12 service-box">
  150. <div class="post text-center">
  151. <?php
  152. if($service_item->choice == 'customizer_repeater_image'){
  153. if ( ! empty( $image ) ) : ?>
  154. <?php if ( ! empty( $link ) ) : ?>
  155. <a href="<?php echo esc_url( $link ); ?>" <?php if($opennewtab== "yes"){ echo "target='_blank'";} ?>>
  156. <?php endif; ?>
  157. <figure class="post-thumbnail">
  158. <img class="services_cols_mn_icon"
  159. src="<?php echo esc_url( $image ); ?>" <?php if ( ! empty( $title ) ) : ?> alt="<?php echo esc_attr( $title ); ?>" title="<?php echo esc_attr( $title ); ?>" <?php endif; ?> />
  160. </figure>
  161. <?php if ( ! empty( $link ) ) : ?>
  162. </a>
  163. <?php endif; ?>
  164. <?php endif;
  165. } else if($service_item->choice =='customizer_repeater_icon'){
  166. ?>
  167.  
  168. <?php if ( ! empty( $icon ) ) :?>
  169.  
  170. <?php if ( ! empty( $link ) ) : ?>
  171. <a href="<?php echo esc_url( $link ); ?>" <?php if($opennewtab== "yes"){ echo "target='_blank'";} ?>>
  172. <?php endif; ?>
  173.  
  174. <figure class="post-thumbnail service-icon">
  175. <i class="fa <?php echo esc_html( $icon ); ?> " <?php if ( ! empty( $color ) ) { echo 'style="background-color:' . $color . '"'; } ?>></i>
  176. </figure>
  177.  
  178. <?php if ( ! empty( $link ) ) : ?>
  179. </a>
  180. <?php endif; ?>
  181.  
  182. <?php endif; ?>
  183.  
  184. <?php } ?>
  185.  
  186. <?php if ( ! empty( $title ) ) : ?>
  187. <div class="entry-header">
  188. <h4 class="entry-title">
  189. <?php if ( ! empty( $link ) ) : ?>
  190. <a href="<?php echo esc_url( $link ); ?>" <?php if($opennewtab== "yes"){ echo "target='_blank'";} ?>>
  191. <?php endif; ?>
  192. <?php echo esc_html( $title ); ?>
  193. <?php if ( ! empty( $link ) ) : ?>
  194. </a>
  195. <?php endif; ?>
  196. </h4>
  197. </div>
  198. <?php endif; ?>
  199.  
  200.  
  201. <?php if ( ! empty( $text ) ) : ?>
  202.  
  203. <div class="entry-content">
  204. <p><?php echo wp_kses( html_entity_decode( $text ), $allowed_html ); ?></p>
  205.  
  206. <?php if(!empty($buttontext)):?>
  207. <?php if(!empty($link)){?>
  208. <p><a href="<?php echo esc_url( $link ); ?>" <?php if($opennewtab =='yes'){echo "target='_blank'";} ?> class="more-link"><?php echo esc_html($buttontext); ?></a></p>
  209. <?php }else {?>
  210. <p><a <?php if($opennewtab =='yes'){echo "target='_blank'";} ?> class="more-link"><?php echo esc_html($buttontext); ?></a></p>
  211. <?php } endif; ?>
  212. </div>
  213.  
  214. <?php endif; ?>
  215. </div>
  216. </div>
  217. <?php
  218. if($j%3==0){ echo "<div class='clearfix'></div>"; } $j++;
  219. endforeach;
  220. }
  221. else
  222. {
  223. $colors = array('#f22853','#6dc82b','#fe8000', '#1abac8');
  224. $title = array (__('Spa treatment','spasalon'), __('Detox Treatment','spasalon'), __('Facial Treatment','spasalon'), __('Other Treatments','spasalon'));
  225. $icon = array('fa fa-leaf','fa fa-street-view','fa fa-user','fa fa-lemon-o');
  226. for($i=0; $i<=3; $i++) { ?>
  227. <div class="col-md-3 col-sm-6 col-xs-12 service-box" title="Shift-click to edit this widget.">
  228. <div class="post text-center">
  229. <a href="#">
  230. <figure class="post-thumbnail service-icon" >
  231. <i class="<?php echo $icon[$i]; ?>" style="background-color:<?php echo $colors[$i]; ?>"></i>
  232. </figure>
  233. <div class="entry-header">
  234. <h4 class="entry-title"><?php echo $title[$i]; ?></h4>
  235. </div>
  236. </a>
  237. <div class="entry-content">
  238. <p><?php echo _e('An veritus voluptatum vim, no duo veritus ocurreret. Stet rebum hendrerit pro an, omnesque salutandi theophrastus ne pri.','spasalon'); ?></p>
  239. <p><a href="#" class="more-link"><?php _e('Read More','spasalon');?></a></p>
  240. </div>
  241. </div>
  242. </div>
  243. <?php }
  244. }
  245. if ( ! $is_callback ) { ?>
  246. </div>
  247. <?php
  248.  
  249. }
  250. }
  251.  
  252.  
  253. ?>
  254.  
  255. <!-- Service Section -->
  256.  
  257. <section id="section" class="service">
  258.  
  259. <div class="container">
  260.  
  261. <!-- Section Title -->
  262.  
  263. <div class="row">
  264.  
  265. <div class="col-md-12">
  266.  
  267. <div class="section-header">
  268.  
  269. <?php if( $current_options['tagline_title'] != '' ): ?>
  270.  
  271. <h1 class="section-title txt-color">
  272.  
  273. <?php echo $current_options['tagline_title']; ?>
  274.  
  275. </h1>
  276.  
  277. <?php endif; ?>
  278.  
  279. <?php if( $current_options['tagline_contents'] != '' ): ?>
  280.  
  281. <p class="section-subtitle">
  282.  
  283. <?php echo $current_options['tagline_contents']; ?>
  284.  
  285. </p>
  286.  
  287. <?php endif; ?>
  288.  
  289. </div>
  290.  
  291. </div>
  292.  
  293. </div>
  294. <!-- /Section Title -->
  295.  
  296.  
  297.  
  298. <div class="row">
  299.  
  300. <?php spasalon_service_content( $spasalon_service_content ); ?>
  301.  
  302. </div>
  303.  
  304.  
  305. </div>
  306.  
  307. </section>
  308.  
  309. <!-- End of Service Section -->
  310.  
  311. <div class="clearfix"></div>
  312.  
  313. <?php endif; ?>
Add Comment
Please, Sign In to add comment