Guest User

Untitled

a guest
Oct 6th, 2018
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.82 KB | None | 0 0
  1. <?php
  2. $default_content = false;
  3. $current_options = get_option('busiprof_pro_theme_options');
  4. $busiprof_service_content = get_theme_mod( 'busiprof_service_content');
  5. if(empty($busiprof_service_content))
  6. {
  7. $pro_service_data = get_option('busiprof_pro_theme_options');
  8. $lite_service_data = get_option('busiprof_theme_options');
  9. if(!empty($pro_service_data))
  10. {
  11. $args = array( 'post_type' => 'busiprof_service') ;
  12. $service = new WP_Query( $args );
  13. if( $service->have_posts() )
  14. {
  15. while ( $service->have_posts() ) : $service->the_post();
  16. $pro_service_data_old[] = array(
  17. 'icon_value' => get_post_meta( get_the_ID(),'service_icon_icons', true ),
  18. 'image_url' => get_the_post_thumbnail_url(),
  19. 'title' => get_the_title(),
  20. 'text' => get_post_meta( get_the_ID(),'meta_service_description', true ),
  21. 'open_new_tab' => get_post_meta( get_the_ID(),'service_icon_target', true ),
  22. 'link' => get_post_meta( get_the_ID(),'service_icon_link', true ),
  23. 'id' => 'customizer_repeater_56d7ea7f40b96',
  24. 'color' => '#2A7BC1',
  25. );
  26. endwhile;
  27. $busiprof_service_content = json_encode($pro_service_data_old);
  28. }
  29. }elseif(!empty($lite_service_data)){
  30.  
  31. $page = get_option( 'theme_mods_busiprof','');
  32. if($page!=''){
  33. foreach($page as $key => $value) {
  34. if($key == 'busiprof_service_content'){
  35. $busiprof_service_content = $value;
  36. }
  37. }
  38. }else{
  39. $service = get_option('busiprof_theme_options');
  40.  
  41. //$busiprof_service_content_control = $wp_customize->get_setting( 'busiprof_service_content' );
  42. //if ( ! empty( $busiprof_service_content_control ) ) {
  43. $busiprof_service_content = json_encode( array(
  44. array(
  45. 'icon_value' => isset($service['service_icon_one'])? $service['service_icon_one']:'',
  46. 'image_url' => isset($service['service_image_one'])? $service['service_image_one']:'',
  47. 'title' => isset($service['service_title_one'])? $service['service_title_one']:'',
  48. 'text' => isset($service['service_text_one'])? $service['service_text_one']:'',
  49. 'link' => '',
  50. 'id' => 'customizer_repeater_56d7ea7f40b56',
  51. 'color' => '#e91e63',
  52. ),
  53. array(
  54. 'icon_value' => isset($service['service_icon_two'])? $service['service_icon_two']:'',
  55. 'image_url' => isset($service['service_image_two'])? $service['service_image_two']:'',
  56. 'title' => isset($service['service_title_two'])? $service['service_title_two']:'',
  57. 'text' => isset($service['service_text_two'])? $service['service_text_two']:'',
  58. 'link' => '',
  59. 'id' => 'customizer_repeater_56d7ea7f40b66',
  60. 'color' => '#00bcd4',
  61. ),
  62. array(
  63. 'icon_value' => isset($service['service_icon_three'])? $service['service_icon_three']:'',
  64. 'image_url' => isset($service['service_image_three'])? $service['service_image_three']:'',
  65. 'title' => isset($service['service_title_three'])? $service['service_title_three']:'',
  66. 'text' => isset($service['service_text_three'])? $service['service_text_three']:'',
  67. 'link' => '',
  68. 'id' => 'customizer_repeater_56d7ea7f40b86',
  69. 'color' => '#4caf50',
  70. ),
  71.  
  72. array(
  73. 'icon_value' => isset($service['service_icon_four'])? $service['service_icon_four']:'',
  74. 'image_url' => isset($service['service_image_four'])? $service['service_image_four']:'',
  75. 'title' => isset($service['service_title_four'])? $service['service_title_four']:'',
  76. 'text' => isset($service['service_text_four'])? $service['service_text_four']:'',
  77. 'link' => '',
  78. 'id' => 'customizer_repeater_56d7ea7f40b96',
  79. 'color' => '#4caf50',
  80. ),
  81.  
  82.  
  83. ) );
  84. //}
  85. }
  86. }
  87. }
  88. $current_options = wp_parse_args( get_option( 'busiprof_pro_theme_options', array() ), theme_data_setup() );
  89. if( $current_options['home_service_section_enabled']=='on' ) { ?>
  90. <!-- Service Section -->
  91. <section id="section" class="service">
  92. <div class="container">
  93.  
  94. <!-- Section Title -->
  95. <div class="row">
  96. <div class="col-md-12">
  97. <div class="section-title">
  98. <?php if( $current_options['service_tag_line'] != '' ) { ?>
  99. <h1 class="section-heading"><?php echo $current_options['service_tag_line']; ?></h1>
  100. <?php } if( $current_options['service_tag_desciption'] != '' ) { ?>
  101. <p><?php echo $current_options['service_tag_desciption']; ?></p>
  102. <?php } ?>
  103. </div>
  104. </div>
  105. </div>
  106. <!-- /Section Title -->
  107.  
  108. <?php busiprof_service_content( $busiprof_service_content,$current_options ); ?>
  109.  
  110. <div class="clearfix"></div>
  111.  
  112.  
  113. <div class="col-md-12 col-xs-12">
  114. <?php if( $current_options['service_readmore_button'] != '' ) { ?>
  115. <div class="btn-wrap">
  116. <?php
  117. if( $current_options['service_readmore_link'] != '' )
  118. {
  119. $link = $current_options['service_readmore_link'];
  120. }
  121. ?>
  122. <a href="<?php echo $link; ?>" <?php if( $current_options['service_readmore_link_target'] == true ) { echo "target='_blank'"; } ?> ><?php echo $current_options['service_readmore_button'];
  123. ?>
  124. </a>
  125. </div>
  126. <?php } ?>
  127. </div>
  128. </div>
  129. </section>
  130. <!-- End of Service Section -->
  131.  
  132. <div class="clearfix"></div>
  133. <?php }
  134. function busiprof_service_content( $busiprof_service_content, $is_callback = false ) {
  135. $current_options = wp_parse_args( get_option( 'busiprof_pro_theme_options', array() ), theme_data_setup() );
  136. if ( ! $is_callback ) { ?>
  137. <div class="row busiprof-features-content">
  138. <?php
  139. }
  140. if ( ! empty( $busiprof_service_content ) ) {
  141. $allowed_html = array(
  142. 'br' => array(),
  143. 'em' => array(),
  144. 'strong' => array(),
  145. 'b' => array(),
  146. 'i' => array(),
  147. );
  148. $busiprof_service_content = json_decode( $busiprof_service_content );
  149. $k=1;
  150. foreach ( $busiprof_service_content as $features_item ) :
  151. $icon = ! empty( $features_item->icon_value ) ? apply_filters( 'busiprof_translate_single_string', $features_item->icon_value, 'Features section' ) : '';
  152. $title = ! empty( $features_item->title ) ? apply_filters( 'busiprof_translate_single_string', $features_item->title, 'Features section' ) : '';
  153. $text = ! empty( $features_item->text ) ? apply_filters( 'busiprof_translate_single_string', $features_item->text, 'Features section' ) : '';
  154. $link = ! empty( $features_item->link ) ? apply_filters( 'busiprof_translate_single_string', $features_item->link, 'Features section' ) : '';
  155. $image = ! empty( $features_item->image_url ) ? apply_filters( 'busiprof_translate_single_string', $features_item->image_url, 'Features section' ) : '';
  156. $color = '';
  157. if ( is_customize_preview() && ! empty( $features_item->color ) ) {
  158. $color = $features_item->color;
  159. }
  160. ?>
  161. <div class="col-md-<?php echo $current_options['service_layout'] ?> col-sm-6 col-xs-12 service-box">
  162. <div class="post">
  163. <?php if ( ! empty( $image ) ) : ?>
  164. <?php if ( ! empty( $link ) ) : ?>
  165. <a href="<?php echo esc_url( $link ); ?>">
  166. <?php endif; ?>
  167. <img class="services_cols_mn_icon"
  168. src="<?php echo esc_url( $image ); ?>" <?php if ( ! empty( $title ) ) : ?> alt="<?php echo esc_attr( $title ); ?>" title="<?php echo esc_attr( $title ); ?>" <?php endif; ?> />
  169. <?php if ( ! empty( $link ) ) : ?>
  170. </a>
  171. <?php endif; ?>
  172. <?php endif; ?>
  173.  
  174. <?php if ( ! empty( $link ) ) : ?>
  175. <a href="<?php echo esc_url( $link ); ?>">
  176. <?php endif; ?>
  177. <?php if ( ! empty( $icon ) ) :?>
  178. <div class="service-icon" <?php if ( ! empty( $color ) ) { echo 'style="color:' . $color . '"'; } ?>>
  179. <i class="fa <?php echo esc_html( $icon ); ?>"></i>
  180. </div>
  181. <?php endif; ?>
  182. <?php if ( ! empty( $title ) ) : ?>
  183.  
  184. <div class="entry-header">
  185. <h4 class="entry-title"><?php echo esc_html( $title ); ?></h4>
  186. </div>
  187. <?php endif; ?>
  188. <?php if ( ! empty( $link ) ) : ?>
  189. </a>
  190. <?php endif; ?>
  191. <?php if ( ! empty( $text ) ) : ?>
  192.  
  193. <div class="entry-content">
  194. <p><?php echo wp_kses( html_entity_decode( $text ), $allowed_html ); ?></p>
  195. </div>
  196.  
  197.  
  198. <?php endif; ?>
  199. </div>
  200. </div>
  201.  
  202. <?php if($k%4==0){ echo '<div class="clearfix"></div>' ; } $k++;
  203. endforeach;
  204. }
  205. else
  206. {
  207. $colors = array('#00bcd4','#e91e63','#4caf50', '#5ca2df');
  208. $title = array (__('Web Design','busiprof'), __('Unique Elements','busiprof'), __('User Friendly','busiprof'), __('24/7 Support','busiprof'));
  209. $icon = array('fa fa-laptop','fa fa-tasks','fa fa-thumbs-o-up','fa fa-life-ring');
  210. for($i=0; $i<=3; $i++) { ?>
  211. <div class="col-md-<?php echo $current_options['service_layout'] ?> col-sm-6 col-xs-12 service-box" title="Shift-click to edit this widget.">
  212. <div class="post">
  213. <a href="#">
  214. <div class="service-icon" style="color:<?php echo $colors[$i]; ?>">
  215. <i class="<?php echo $icon[$i]; ?>"></i>
  216. </div>
  217. <div class="entry-header">
  218. <h4 class="entry-title"><?php echo $title[$i]; ?></h4>
  219. </div>
  220. </a>
  221. <div class="entry-content">
  222. <p><?php echo _e('It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout.','busiprof'); ?></p>
  223. </div>
  224. </div>
  225. </div>
  226. <?php }
  227. }
  228. if ( ! $is_callback ) { ?>
  229. </div>
  230. <?php
  231. }
  232. }
  233. /*
  234. if ( function_exists( 'busiprof_features' ) ) {
  235. $section_priority = apply_filters( 'busiprof_section_priority', 10, 'busiprof_features' );
  236. add_action( 'busiprof_sections', 'busiprof_features', absint( $section_priority ) );
  237. add_action( 'after_setup_theme', 'busiprof_features_register_strings', 11 );
  238. }*/
  239. ?>
Add Comment
Please, Sign In to add comment