Guest User

Untitled

a guest
Nov 15th, 2018
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.67 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. foreach ( $busiprof_service_content as $features_item ) :
  150. $icon = ! empty( $features_item->icon_value ) ? apply_filters( 'busiprof_translate_single_string', $features_item->icon_value, 'Features section' ) : '';
  151. $title = ! empty( $features_item->title ) ? apply_filters( 'busiprof_translate_single_string', $features_item->title, 'Features section' ) : '';
  152. $text = ! empty( $features_item->text ) ? apply_filters( 'busiprof_translate_single_string', $features_item->text, 'Features section' ) : '';
  153. $link = ! empty( $features_item->link ) ? apply_filters( 'busiprof_translate_single_string', $features_item->link, 'Features section' ) : '';
  154. $image = ! empty( $features_item->image_url ) ? apply_filters( 'busiprof_translate_single_string', $features_item->image_url, 'Features section' ) : '';
  155. $color = '';
  156. $color = $features_item->color;
  157.  
  158. ?>
  159. <div class="col-md-<?php echo $current_options['service_layout'] ?> col-sm-6 col-xs-12 service-box">
  160. <div class="post">
  161. <?php if ( ! empty( $image ) ) : ?>
  162. <?php if ( ! empty( $link ) ) : ?>
  163. <a href="<?php echo esc_url( $link ); ?>">
  164. <?php endif; ?>
  165. <img class="services_cols_mn_icon"
  166. src="<?php echo esc_url( $image ); ?>" <?php if ( ! empty( $title ) ) : ?> alt="<?php echo esc_attr( $title ); ?>" title="<?php echo esc_attr( $title ); ?>" <?php endif; ?> />
  167. <?php if ( ! empty( $link ) ) : ?>
  168. </a>
  169. <?php endif; ?>
  170. <?php endif; ?>
  171.  
  172. <?php if ( ! empty( $link ) ) : ?>
  173. <a href="<?php echo esc_url( $link ); ?>">
  174. <?php endif; ?>
  175. <?php if ( ! empty( $icon ) ) :?>
  176. <div class="service-icon" <?php if ( ! empty( $color ) ) { echo 'style="color:' . $color . '"'; } ?>>
  177. <i class="fa <?php echo esc_html( $icon ); ?>"></i>
  178. </div>
  179. <?php endif; ?>
  180. <?php if ( ! empty( $title ) ) : ?>
  181.  
  182. <div class="entry-header">
  183. <h4 class="entry-title"><?php echo esc_html( $title ); ?></h4>
  184. </div>
  185. <?php endif; ?>
  186. <?php if ( ! empty( $link ) ) : ?>
  187. </a>
  188. <?php endif; ?>
  189. <?php if ( ! empty( $text ) ) : ?>
  190.  
  191. <div class="entry-content">
  192. <p><?php echo wp_kses( html_entity_decode( $text ), $allowed_html ); ?></p>
  193. </div>
  194.  
  195.  
  196. <?php endif; ?>
  197. </div>
  198. </div>
  199. <?php
  200. endforeach;
  201. }
  202. else
  203. {
  204. $colors = array('#00bcd4','#e91e63','#4caf50', '#5ca2df');
  205. $title = array (__('Web Design','busiprof'), __('Unique Elements','busiprof'), __('User Friendly','busiprof'), __('24/7 Support','busiprof'));
  206. $icon = array('fa fa-laptop','fa fa-tasks','fa fa-thumbs-o-up','fa fa-life-ring');
  207. for($i=0; $i<=3; $i++) { ?>
  208. <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.">
  209. <div class="post">
  210. <a href="#">
  211. <div class="service-icon" style="color:<?php echo $colors[$i]; ?>">
  212. <i class="<?php echo $icon[$i]; ?>"></i>
  213. </div>
  214. <div class="entry-header">
  215. <h4 class="entry-title"><?php echo $title[$i]; ?></h4>
  216. </div>
  217. </a>
  218. <div class="entry-content">
  219. <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>
  220. </div>
  221. </div>
  222. </div>
  223. <?php }
  224. }
  225. if ( ! $is_callback ) { ?>
  226. </div>
  227. <?php
  228. }
  229. }
  230. /*
  231. if ( function_exists( 'busiprof_features' ) ) {
  232. $section_priority = apply_filters( 'busiprof_section_priority', 10, 'busiprof_features' );
  233. add_action( 'busiprof_sections', 'busiprof_features', absint( $section_priority ) );
  234. add_action( 'after_setup_theme', 'busiprof_features_register_strings', 11 );
  235. }*/
  236. ?>
Add Comment
Please, Sign In to add comment