Guest User

Untitled

a guest
Aug 22nd, 2016
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.58 KB | None | 0 0
  1. <?php
  2. // Template Name: Service Template
  3. /**
  4. * @Theme Name : wallstreet-Pro
  5. * @file : service-template.php
  6. * @package : wallstreet-Pro
  7. @author : webriti
  8. * @filesource : wp-content/themes/wallstreet/service-template.php
  9. */
  10. get_header(); ?>
  11. <!-- Page Title Section -->
  12.  
  13. <!-- /Page Title Section -->
  14. <?php $wallstreet_pro_options=theme_data_setup();
  15. $current_options = wp_parse_args( get_option( 'wallstreet_pro_options', array() ), $wallstreet_pro_options ); ?>
  16. <!-- Service Section -->
  17. <div class="container">
  18. <div class="row">
  19. <div class="section_heading_title">
  20. <?php if($current_options['service_title'] !='') ?>
  21. <h1><?php echo $current_options['service_title']; ?></h1>
  22. <div class="pagetitle-separator"></div>
  23. <?php if($current_options['service_description'] !='') ?>
  24. <p><?php echo $current_options['service_description']; ?></p>
  25. </div>
  26. </div>
  27. <div class="row">
  28. <?php
  29. $count_posts = wp_count_posts( 'wallstreet_service')->publish;
  30. if($count_posts > 3)
  31. {$count_posts = 3;}
  32. $arg = array( 'post_type' => 'wallstreet_service','posts_per_page' =>$count_posts);
  33. $service = new WP_Query( $arg );
  34. if($service->have_posts())
  35. {
  36. while ( $service->have_posts() ) { $service->the_post();
  37. $service_icon_image =sanitize_text_field( get_post_meta( get_the_ID(), 'service_icon_image', true ));
  38. $service_icon_target =sanitize_text_field( get_post_meta( get_the_ID(), 'service_icon_target', true ));
  39. $meta_service_link =sanitize_text_field( get_post_meta( get_the_ID(), 'meta_service_link', true ));
  40. $meta_service_target =sanitize_text_field( get_post_meta( get_the_ID(), 'meta_service_target', true ));
  41. $service_description_text =sanitize_text_field( get_post_meta( get_the_ID(), 'service_description_text', true ));
  42. $service_readmore_text =sanitize_text_field( get_post_meta( get_the_ID(), 'service_readmore_text', true ));
  43. ?>
  44. <div class="col-md-4 col-sm-6 service-effect">
  45. <?php
  46. if(get_post_meta( get_the_ID(),'meta_service_link', true ))
  47. { $meta_service_link= $meta_service_link ; }
  48. else
  49. { $meta_service_link = get_the_permalink(); }
  50. ?>
  51. <?php if(($service_icon_target) && ($service_icon_image)){ ?>
  52. <div class="other-service-area1">
  53. <a href="<?php echo $meta_service_link; ?>" <?php if(get_post_meta( get_the_ID(),'meta_service_target', true )) { echo 'target="_blank"'; } ?>>
  54. <i class="fa <?php if($service_icon_image) { echo $service_icon_image; } ?>"></i>
  55. </a>
  56. </div>
  57. <?php } else {
  58. $defalt_arg =array('class' => "img-responsive");
  59. if(has_post_thumbnail()){ ?>
  60. <div class="service-box">
  61. <a href="<?php echo $meta_service_link; ?>" <?php if(get_post_meta( get_the_ID(),'meta_service_target', true )) { echo 'target="_blank"'; } ?>>
  62. <?php the_post_thumbnail('', $defalt_arg); ?>
  63. </a>
  64. </div>
  65. <?php } else { ?>
  66. <div class="other-service-area1">
  67. <a href="<?php echo $meta_service_link; ?>" <?php if(get_post_meta( get_the_ID(),'meta_service_target', true )) { echo 'target="_blank"'; } ?>>
  68. <i class="fa" style="font-size:24px;"><?php _e('Insert Your Icon','wallstreet'); ?></i>
  69. </a>
  70. </div>
  71. <?php }
  72. } ?>
  73. <div class="service-area">
  74. <h2><a href="<?php echo $meta_service_link; ?>" <?php if($meta_service_target) { echo 'target="_blank"'; } ?> ><?php the_title(); ?></a></h2>
  75. <p><?php if($service_description_text){ echo $service_description_text; } ?></p>
  76. <?php if($service_readmore_text){ ?>
  77. <div class="service-btn"><a href="<?php echo $meta_service_link; ?>"> <?php echo $service_readmore_text; ?> </a></div>
  78. <?php } ?>
  79. </div>
  80. </div>
  81. <?php } } else {
  82. $service_title = array('', 'Product Designing', 'Wordpress Themes', 'Responsive Design');
  83. for($i=1 ; $i<=3 ; $i++)
  84. { ?>
  85. <div class="col-md-4 col-sm-6 service-effect">
  86. <div class="service-box">
  87. <img class="img-responsive" src="<?php echo WEBRITI_TEMPLATE_DIR_URI ?>/images/service<?php echo $i; ?>.jpg">
  88. </div>
  89. <div class="service-area">
  90. <h2><a href="#"><?php echo $service_title[$i]; ?></a></h2>
  91. <p><?php _e('Lorem ipsum dolor sit amet, consectetur adipisicing elit.Lorem ipsum dolor sit amet, consectetur adipisicing elit dignissim dapib tumst dign eger porta nisl.', 'wallstreet'); ?></p>
  92. <div class="service-btn"><a href="#"><?php _e('Read more', 'wallstreet'); ?></a></div>
  93. </div>
  94. </div>
  95. <?php } } ?>
  96. </div>
  97. </div>
  98. <!-- /Service Section -->
  99.  
  100. <!-- Our Other Service Section -->
  101. <div class="container">
  102. <?php get_template_part('index', 'calloutarea'); ?>
  103.  
  104. <?php if($current_options['other_service_section_enabled']==true) { ?>
  105. <?php
  106. $count_posts = wp_count_posts( 'wallstreet_service')->publish;
  107. if( $count_posts >= 4 || $count_posts == 0)
  108. {
  109. ?>
  110. <div class="row">
  111. <div class="section_heading_title">
  112. <?php if($current_options['other_service_title'] !='') ?>
  113. <h1><?php echo $current_options['other_service_title']; ?></h1>
  114. <div class="pagetitle-separator"></div>
  115. <?php if($current_options['other_service_description'] !='') ?>
  116. <p><?php echo $current_options['other_service_description']; ?></p>
  117. </div>
  118. </div>
  119. <?php } ?>
  120. <div class="row">
  121. <?php
  122. $j=1;
  123. $count_posts = wp_count_posts( 'wallstreet_service')->publish;
  124. $arg = array( 'offset' => '3', 'post_type' => 'wallstreet_service','posts_per_page' =>$count_posts);
  125. $service = new WP_Query( $arg );
  126. if($service->have_posts())
  127. {
  128. while ( $service->have_posts() ) { $service->the_post();
  129. $service_icon_image =sanitize_text_field( get_post_meta( get_the_ID(), 'service_icon_image', true ));
  130. $service_icon_target =sanitize_text_field( get_post_meta( get_the_ID(), 'service_icon_target', true ));
  131. $service_description_text =sanitize_text_field( get_post_meta( get_the_ID(), 'service_description_text', true ));
  132. $meta_service_link =sanitize_text_field( get_post_meta( get_the_ID(), 'meta_service_link', true ));
  133. $meta_service_target =sanitize_text_field( get_post_meta( get_the_ID(), 'meta_service_target', true ));
  134. $service_readmore_text =sanitize_text_field( get_post_meta( get_the_ID(), 'service_readmore_text', true ));
  135. ?>
  136. <?php if(($service_icon_target) && ($service_icon_image)){ ?>
  137. <div class="col-md-3 other-service-area">
  138. <a href="<?php echo $meta_service_link; ?>" <?php if(get_post_meta( get_the_ID(),'meta_service_target', true )) { echo 'target="_blank"'; } ?>>
  139. <i class="fa <?php if($service_icon_image) { echo $service_icon_image; } ?>"></i>
  140. </a>
  141. <a href="<?php echo $meta_service_link; ?>" <?php if(get_post_meta( get_the_ID(),'meta_service_target', true )) { echo 'target="_blank"'; } ?>> <h2><?php the_title(); ?></h2>
  142. </a>
  143. <p><?php if($service_description_text){ echo $service_description_text; } ?></p>
  144. </div>
  145. <?php } else {
  146.  
  147. $defalt_arg =array('class' => "img-responsive");
  148. if(has_post_thumbnail()){ ?>
  149. <div class="col-md-3 other-service-area service-box1">
  150. <a href="<?php echo $meta_service_link; ?>" <?php if(get_post_meta( get_the_ID(),'meta_service_target', true )) { echo 'target="_blank"'; } ?>>
  151. <?php the_post_thumbnail('', $defalt_arg); ?>
  152. </a>
  153.  
  154. <a href="<?php echo $meta_service_link; ?>" <?php if(get_post_meta( get_the_ID(),'meta_service_target', true )) { echo 'target="_blank"'; } ?>>
  155. <h2><?php the_title(); ?></h2>
  156. </a>
  157. <p><?php if($service_description_text){ echo $service_description_text; } ?></p>
  158. </div>
  159. <?php } else { ?>
  160. <div class="col-md-3 other-service-area">
  161. <i class="fa" style="font-size:16px;"><?php _e('Insert Your Icon','wallstreet'); ?></i>
  162. <h2><?php the_title(); ?></h2>
  163. <p><?php if($service_description_text){ echo $service_description_text; } ?></p>
  164. </div>
  165. <?php } }
  166. if($j%4==0){ echo "<div class='clearfix'></div>"; } $j++;
  167. } } else { ?>
  168. <?php
  169. $count_posts = wp_count_posts( 'wallstreet_service')->publish;
  170. $service_title = array('Responsive', 'Wordpress Themes', 'Mobile Ready', 'Live Support');
  171. $other_service_icon = array('fa-tablet', 'fa-tachometer', 'fa-mobile', 'fa-support');
  172. if( $count_posts >= 4 || $count_posts == 0 )
  173. {
  174. for($i=0 ; $i<=3 ; $i++)
  175. { ?>
  176. <div class="col-md-3 other-service-area">
  177. <a href=""><i class="fa <?php echo $other_service_icon[$i]; ?>"></i></a>
  178. <h2><?php echo $service_title[$i]; ?></h2>
  179. <p><?php _e('Mauris rhoncus pretium porttitor Cras scelerisque commodo odio Phasellus dolor.', 'wallstreet'); ?></p>
  180. </div>
  181. <?php } } } ?>
  182. </div>
  183. <?php } ?>
  184. </div>
  185. <?php get_footer(); ?>
  186. <!-- /Our Other Service Section -->
Add Comment
Please, Sign In to add comment