Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $current_options = wp_parse_args( get_option( 'spa_theme_options', array() ), default_data() );
- if( $current_options['service_hide'] != false ):
- $spasalon_service_content = ! empty($current_options['spasalon_service_content']) ? $current_options['spasalon_service_content'] : '';
- //$spasalon_service_content = get_option( 'spa_theme_options')['spasalon_service_content'];
- if(empty($spasalon_service_content))
- {
- $ThemeData = get_option('spa_theme_options');
- if (!empty($current_options['slider_cat'])){
- // Run this code section if user comes form pro old.
- //$ServiceOldData = get_option('widget_wbr_feature_page_widget');
- //if(sizeof($ServiceOldData)>1){
- $ServiceOldData = get_option('widget_wbr_feature_page_widget');
- $the_sidebars = wp_get_sidebars_widgets();
- if(!empty($the_sidebars['sidebar-service'])){
- $pro_service_data = array();
- foreach ($the_sidebars['sidebar-service'] as $data) {
- $widget_data = explode('-',$data);
- $data = $widget_data[1];
- if($widget_data[0] == 'wbr_feature_page_widget'){
- $options = get_option( 'widget_wbr_feature_page_widget' );
- $pro_service_data[] = array(
- 'icon_value' => isset($options[$widget_data[1]]['icon'])? $options[$widget_data[1]]['icon'] : '',
- 'image_url' => isset($options[$widget_data[1]]['selected_page'])? get_the_post_thumbnail_url($options[$widget_data[1]]['selected_page']) :'',
- 'title' => isset($options[$widget_data[1]]['selected_page'])? get_the_title( $options[$widget_data[1]]['selected_page'] ) : '',
- 'text' => isset($options[$widget_data[1]]['selected_page'])? get_post_field('post_content', $options[$widget_data[1]]['selected_page']) : '',
- 'color' => '#f22853',
- 'button_text' => isset($options[$widget_data[1]]['buttontext'])? $options[$widget_data[1]]['buttontext'] : '',
- 'link' => isset($options[$widget_data[1]]['buttonlink'])? $options[$widget_data[1]]['buttonlink'] : '',
- 'choice' => 'customizer_repeater_icon',
- 'open_new_tab' => isset($options[$widget_data[1]]['target']) ? $options[$widget_data[1]]['target'] : '',
- 'id' => 'customizer_repeater_56d7ea7f40b56',
- );
- }
- }
- $spasalon_service_content = json_encode($pro_service_data);
- //}
- }else
- {
- $spasalon_service_content = json_encode( array(
- array(
- 'icon_value' => 'fa fa-leaf',
- 'image_url' => '',
- 'title' => esc_html__( 'Spa treatment', 'spasalon' ),
- 'text' => 'An veritus voluptatum vim, no duo veritus ocurreret. Stet rebum hendrerit pro an, omnesque salutandi theophrastus ne pri.',
- 'color' => '#f22853',
- 'choice' => 'customizer_repeater_icon',
- 'button_text' => 'Read More',
- 'link' => '#',
- 'open_new_tab' => 'yes',
- 'id' => 'customizer_repeater_56d7ea7f40b56',
- ),
- array(
- 'icon_value' => 'fa fa-street-view',
- 'image_url' => '',
- 'title' => esc_html__( 'Detox Treatment', 'spasalon' ),
- 'text' => 'An veritus voluptatum vim, no duo veritus ocurreret. Stet rebum hendrerit pro an, omnesque salutandi theophrastus ne pri.',
- 'color' => '#6dc82b',
- 'choice' => 'customizer_repeater_icon',
- 'button_text' => 'Read More',
- 'link' => '#',
- 'open_new_tab' => 'yes',
- 'id' => 'customizer_repeater_56d7ea7f40b66',
- ),
- array(
- 'icon_value' => 'fa fa-user',
- 'image_url' => '',
- 'title' => esc_html__( 'Facial Treatment', 'spasalon' ),
- 'text' => 'An veritus voluptatum vim, no duo veritus ocurreret. Stet rebum hendrerit pro an, omnesque salutandi theophrastus ne pri.',
- 'color' => '#fe8000',
- 'choice' => 'customizer_repeater_icon',
- 'button_text' => 'Read More',
- 'link' => '#',
- 'open_new_tab' => 'yes',
- 'id' => 'customizer_repeater_56d7ea7f40b86',
- ),
- array(
- 'icon_value' => 'fa fa-lemon-o',
- 'image_url' => '',
- 'title' => esc_html__( 'Other Treatments', 'spasalon' ),
- 'text' => 'An veritus voluptatum vim, no duo veritus ocurreret. Stet rebum hendrerit pro an, omnesque salutandi theophrastus ne pri.',
- 'color' => '#1abac8',
- 'choice' => 'customizer_repeater_icon',
- 'button_text' => 'Read More',
- 'link' => '#',
- 'open_new_tab' => 'yes',
- 'id' => 'customizer_repeater_56d7ea7f40b86',
- ),
- ) );
- }
- }
- }
- function spasalon_service_content( $spasalon_service_content, $is_callback = false ) {
- if ( ! $is_callback ) { ?>
- <div class="spasalon-service-content">
- <?php
- }
- if ( ! empty( $spasalon_service_content ) ) {
- $allowed_html = array(
- 'br' => array(),
- 'em' => array(),
- 'strong' => array(),
- 'b' => array(),
- 'i' => array(),
- );
- $spasalon_service_content = json_decode( $spasalon_service_content );
- $j=1;
- foreach ( $spasalon_service_content as $service_item ) :
- $icon = ! empty( $service_item->icon_value ) ? apply_filters( 'spasalon_translate_single_string', $service_item->icon_value, 'service section' ) : '';
- $title = ! empty( $service_item->title ) ? apply_filters( 'spasalon_translate_single_string', $service_item->title, 'service section' ) : '';
- $text = ! empty( $service_item->text ) ? apply_filters( 'spasalon_translate_single_string', $service_item->text, 'service section' ) : '';
- $link = ! empty( $service_item->link ) ? apply_filters( 'spasalon_translate_single_string', $service_item->link, 'service section' ) : '';
- $image = ! empty( $service_item->image_url ) ? apply_filters( 'spasalon_translate_single_string', $service_item->image_url, 'service section' ) : '';
- $buttontext = ! empty( $service_item->button_text ) ? apply_filters( 'spasalon_translate_single_string', $service_item->button_text, 'service section' ) : '';
- $opennewtab = ! empty( $service_item->open_new_tab) ? apply_filters('spasalon_translate_single_string',$service_item->open_new_tab, 'service section' ) : '';
- $color = '';
- if ( is_customize_preview() && ! empty( $service_item->color ) ) {
- $color = $service_item->color;
- }
- ?>
- <div class="col-md-4 col-sm-6 col-xs-12 service-box">
- <div class="post text-center">
- <?php
- if($service_item->choice == 'customizer_repeater_image'){
- if ( ! empty( $image ) ) : ?>
- <?php if ( ! empty( $link ) ) : ?>
- <a href="<?php echo esc_url( $link ); ?>" <?php if($opennewtab== "yes"){ echo "target='_blank'";} ?>>
- <?php endif; ?>
- <figure class="post-thumbnail">
- <img class="services_cols_mn_icon"
- src="<?php echo esc_url( $image ); ?>" <?php if ( ! empty( $title ) ) : ?> alt="<?php echo esc_attr( $title ); ?>" title="<?php echo esc_attr( $title ); ?>" <?php endif; ?> />
- </figure>
- <?php if ( ! empty( $link ) ) : ?>
- </a>
- <?php endif; ?>
- <?php endif;
- } else if($service_item->choice =='customizer_repeater_icon'){
- ?>
- <?php if ( ! empty( $icon ) ) :?>
- <?php if ( ! empty( $link ) ) : ?>
- <a href="<?php echo esc_url( $link ); ?>" <?php if($opennewtab== "yes"){ echo "target='_blank'";} ?>>
- <?php endif; ?>
- <figure class="post-thumbnail service-icon">
- <i class="fa <?php echo esc_html( $icon ); ?> " <?php if ( ! empty( $color ) ) { echo 'style="background-color:' . $color . '"'; } ?>></i>
- </figure>
- <?php if ( ! empty( $link ) ) : ?>
- </a>
- <?php endif; ?>
- <?php endif; ?>
- <?php } ?>
- <?php if ( ! empty( $title ) ) : ?>
- <div class="entry-header">
- <h4 class="entry-title">
- <?php if ( ! empty( $link ) ) : ?>
- <a href="<?php echo esc_url( $link ); ?>" <?php if($opennewtab== "yes"){ echo "target='_blank'";} ?>>
- <?php endif; ?>
- <?php echo esc_html( $title ); ?>
- <?php if ( ! empty( $link ) ) : ?>
- </a>
- <?php endif; ?>
- </h4>
- </div>
- <?php endif; ?>
- <?php if ( ! empty( $text ) ) : ?>
- <div class="entry-content">
- <p><?php echo wp_kses( html_entity_decode( $text ), $allowed_html ); ?></p>
- <?php if(!empty($buttontext)):?>
- <?php if(!empty($link)){?>
- <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>
- <?php }else {?>
- <p><a <?php if($opennewtab =='yes'){echo "target='_blank'";} ?> class="more-link"><?php echo esc_html($buttontext); ?></a></p>
- <?php } endif; ?>
- </div>
- <?php endif; ?>
- </div>
- </div>
- <?php
- if($j%3==0){ echo "<div class='clearfix'></div>"; } $j++;
- endforeach;
- }
- else
- {
- $colors = array('#f22853','#6dc82b','#fe8000', '#1abac8');
- $title = array (__('Spa treatment','spasalon'), __('Detox Treatment','spasalon'), __('Facial Treatment','spasalon'), __('Other Treatments','spasalon'));
- $icon = array('fa fa-leaf','fa fa-street-view','fa fa-user','fa fa-lemon-o');
- for($i=0; $i<=3; $i++) { ?>
- <div class="col-md-3 col-sm-6 col-xs-12 service-box" title="Shift-click to edit this widget.">
- <div class="post text-center">
- <a href="#">
- <figure class="post-thumbnail service-icon" >
- <i class="<?php echo $icon[$i]; ?>" style="background-color:<?php echo $colors[$i]; ?>"></i>
- </figure>
- <div class="entry-header">
- <h4 class="entry-title"><?php echo $title[$i]; ?></h4>
- </div>
- </a>
- <div class="entry-content">
- <p><?php echo _e('An veritus voluptatum vim, no duo veritus ocurreret. Stet rebum hendrerit pro an, omnesque salutandi theophrastus ne pri.','spasalon'); ?></p>
- <p><a href="#" class="more-link"><?php _e('Read More','spasalon');?></a></p>
- </div>
- </div>
- </div>
- <?php }
- }
- if ( ! $is_callback ) { ?>
- </div>
- <?php
- }
- }
- ?>
- <!-- Service Section -->
- <section id="section" class="service">
- <div class="container">
- <!-- Section Title -->
- <div class="row">
- <div class="col-md-12">
- <div class="section-header">
- <?php if( $current_options['tagline_title'] != '' ): ?>
- <h1 class="section-title txt-color">
- <?php echo $current_options['tagline_title']; ?>
- </h1>
- <?php endif; ?>
- <?php if( $current_options['tagline_contents'] != '' ): ?>
- <p class="section-subtitle">
- <?php echo $current_options['tagline_contents']; ?>
- </p>
- <?php endif; ?>
- </div>
- </div>
- </div>
- <!-- /Section Title -->
- <div class="row">
- <?php spasalon_service_content( $spasalon_service_content ); ?>
- </div>
- </div>
- </section>
- <!-- End of Service Section -->
- <div class="clearfix"></div>
- <?php endif; ?>
Add Comment
Please, Sign In to add comment