Guest User

Untitled

a guest
Feb 8th, 2020
41
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 11.25 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.  
  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. <div class="col-md-4 col-sm-6 col-xs-12 service-box">
  148. <div class="post text-center">
  149. <?php
  150. if($service_item->choice == 'customizer_repeater_image'){
  151. if ( ! empty( $image ) ) : ?>
  152. <?php if ( ! empty( $link ) ) : ?>
  153. <a href="<?php echo esc_url( $link ); ?>" <?php if($opennewtab== "yes"){ echo "target='_blank'";} ?>>
  154. <?php endif; ?>
  155. <figure class="post-thumbnail">
  156. <img class="services_cols_mn_icon"
  157. src="<?php echo esc_url( $image ); ?>" <?php if ( ! empty( $title ) ) : ?> alt="<?php echo esc_attr( $title ); ?>" title="<?php echo esc_attr( $title ); ?>" <?php endif; ?> />
  158. </figure>
  159. <?php if ( ! empty( $link ) ) : ?>
  160. </a>
  161. <?php endif; ?>
  162. <?php endif;
  163. } else if($service_item->choice =='customizer_repeater_icon'){
  164. ?>
  165.  
  166. <?php if ( ! empty( $icon ) ) :?>
  167.  
  168. <?php if ( ! empty( $link ) ) : ?>
  169. <a href="<?php echo esc_url( $link ); ?>" <?php if($opennewtab== "yes"){ echo "target='_blank'";} ?>>
  170. <?php endif; ?>
  171.  
  172. <figure class="post-thumbnail service-icon">
  173. <i class="fa <?php echo esc_html( $icon ); ?> " <?php if ( ! empty( $color ) ) { echo 'style="background-color:' . $color . '"'; } ?>></i>
  174. </figure>
  175.  
  176. <?php if ( ! empty( $link ) ) : ?>
  177. </a>
  178. <?php endif; ?>
  179.  
  180. <?php endif; ?>
  181.  
  182. <?php } ?>
  183.  
  184. <?php if ( ! empty( $title ) ) : ?>
  185. <div class="entry-header">
  186. <h4 class="entry-title">
  187. <?php if ( ! empty( $link ) ) : ?>
  188. <a href="<?php echo esc_url( $link ); ?>" <?php if($opennewtab== "yes"){ echo "target='_blank'";} ?>>
  189. <?php endif; ?>
  190. <?php echo esc_html( $title ); ?>
  191. <?php if ( ! empty( $link ) ) : ?>
  192. </a>
  193. <?php endif; ?>
  194. </h4>
  195. </div>
  196. <?php endif; ?>
  197.  
  198.  
  199. <?php if ( ! empty( $text ) ) : ?>
  200.  
  201. <div class="entry-content">
  202. <p><?php echo wp_kses( html_entity_decode( $text ), $allowed_html ); ?></p>
  203.  
  204. <?php if(!empty($buttontext)):?>
  205. <?php if(!empty($link)){?>
  206. <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>
  207. <?php }else {?>
  208. <p><a <?php if($opennewtab =='yes'){echo "target='_blank'";} ?> class="more-link"><?php echo esc_html($buttontext); ?></a></p>
  209. <?php } endif; ?>
  210. </div>
  211.  
  212. <?php endif; ?>
  213. </div>
  214. </div>
  215. <?php
  216. endforeach;
  217. }
  218. else
  219. {
  220. $colors = array('#f22853','#6dc82b','#fe8000', '#1abac8');
  221. $title = array (__('Spa treatment','spasalon'), __('Detox Treatment','spasalon'), __('Facial Treatment','spasalon'), __('Other Treatments','spasalon'));
  222. $icon = array('fa fa-leaf','fa fa-street-view','fa fa-user','fa fa-lemon-o');
  223. for($i=0; $i<=3; $i++) { ?>
  224. <div class="col-md-3 col-sm-6 col-xs-12 service-box" title="Shift-click to edit this widget.">
  225. <div class="post text-center">
  226. <a href="#">
  227. <figure class="post-thumbnail service-icon" >
  228. <i class="<?php echo $icon[$i]; ?>" style="background-color:<?php echo $colors[$i]; ?>"></i>
  229. </figure>
  230. <div class="entry-header">
  231. <h4 class="entry-title"><?php echo $title[$i]; ?></h4>
  232. </div>
  233. </a>
  234. <div class="entry-content">
  235. <p><?php echo _e('An veritus voluptatum vim, no duo veritus ocurreret. Stet rebum hendrerit pro an, omnesque salutandi theophrastus ne pri.','spasalon'); ?></p>
  236. <p><a href="#" class="more-link"><?php _e('Read More','spasalon');?></a></p>
  237. </div>
  238. </div>
  239. </div>
  240. <?php }
  241. }
  242. if ( ! $is_callback ) { ?>
  243. </div>
  244. <?php
  245.  
  246. }
  247. }
  248.  
  249.  
  250. ?>
  251.  
  252. <!-- Service Section -->
  253.  
  254. <section id="section" class="service">
  255.  
  256. <div class="container">
  257.  
  258. <!-- Section Title -->
  259.  
  260. <div class="row">
  261.  
  262. <div class="col-md-12">
  263.  
  264. <div class="section-header">
  265.  
  266. <?php if( $current_options['tagline_title'] != '' ): ?>
  267.  
  268. <h1 class="section-title txt-color">
  269.  
  270. <?php echo $current_options['tagline_title']; ?>
  271.  
  272. </h1>
  273.  
  274. <?php endif; ?>
  275.  
  276. <?php if( $current_options['tagline_contents'] != '' ): ?>
  277.  
  278. <p class="section-subtitle">
  279.  
  280. <?php echo $current_options['tagline_contents']; ?>
  281.  
  282. </p>
  283.  
  284. <?php endif; ?>
  285.  
  286. </div>
  287.  
  288. </div>
  289.  
  290. </div>
  291. <!-- /Section Title -->
  292.  
  293.  
  294.  
  295. <div class="row">
  296.  
  297. <?php spasalon_service_content( $spasalon_service_content ); ?>
  298.  
  299. </div>
  300.  
  301.  
  302. </div>
  303.  
  304. </section>
  305.  
  306. <!-- End of Service Section -->
  307.  
  308. <div class="clearfix"></div>
  309.  
  310. <?php endif; ?>
Add Comment
Please, Sign In to add comment