page-care.php 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  1. <?php
  2. /**
  3. * Template Name: Home Page
  4. */
  5. $post_id = get_the_ID();
  6. $page_data = get_post_meta( $post_id, 'ptc_care', true );
  7. $stores = $page_data['stores'];
  8. $store_count = $page_data['store_count'];
  9. ?>
  10. <?php get_template_part( 'part', 'header' ) ?>
  11. <body>
  12. <?php get_template_part( 'part', 'nav' ) ?>
  13. <div id="banner-swiper" class="swiper">
  14. <div class="swiper-wrapper">
  15. <?php
  16. ?>
  17. <?php
  18. if(is_array( $page_data['sliders'] ) && !empty( $page_data['sliders'] )){
  19. foreach( $page_data['sliders'] as $item ){
  20. ?>
  21. <div class="swiper-slide banner" style="--bg-sm: url('<?php echo $item; ?>'); --bg-md: url('<?php echo $item; ?>')"></div>
  22. <?php }
  23. } ?>
  24. </div>
  25. <div class="swiper-pagination"></div>
  26. </div>
  27. <div class="services-wrap">
  28. <div class="services">
  29. <?php
  30. $items = ptc_get_product_list();
  31. if(is_array( $items ) && !empty( $items )){
  32. foreach( $items as $item ){
  33. ?>
  34. <div class="service">
  35. <p class="service-name"><i class="service-icon" style="background-image: url(<?php echo $item['image']; ?>);"></i><?php echo $item['name'] ?></p>
  36. <p class="service-desc">
  37. <?php echo $item['remark'] ?>
  38. </p>
  39. <ul class="service-details">
  40. <?php
  41. foreach ($item['rights'] as $right ):
  42. ?>
  43. <li class="item">
  44. <span class="item-name"><?php echo $right['title'] ?></span>
  45. <span class="item-value"><?php echo $right['value'] ?></span>
  46. </li>
  47. <?php endforeach; ?>
  48. </ul>
  49. <div class="service-cost">
  50. <div class="price">
  51. <span class="p1">$</span><span class="p2"><?php echo $item['amount_month'] ?></span
  52. ><span class="p3">Monthly</span>
  53. </div>
  54. <button class="buy" data-action="buy" data-id="<?php echo $item['id'] ?>">Buy Now</button>
  55. </div>
  56. </div>
  57. <?php
  58. }
  59. }
  60. ?>
  61. </div>
  62. </div>
  63. <div class="details">
  64. <div class="details-inner">
  65. <?php
  66. if(is_array( $page_data['items'] ) && !empty( $page_data['items'] )){
  67. foreach( $page_data['items'] as $item ){
  68. ?>
  69. <div class="detail">
  70. <h3 class="d-title"><?php echo $item['title'] ?></h3>
  71. <p class="d-content">
  72. <?php echo $item['desc'] ?>
  73. </p>
  74. <img class="d-img" src="<?php echo $item['thumb'] ?>" />
  75. </div>
  76. <?php }} ?>
  77. </div>
  78. </div>
  79. <div class="others">
  80. <div class="block">
  81. <h3 class="block-title tac underline">Common Problem</h3>
  82. <ul class="problems">
  83. <?php
  84. $args = array(
  85. 'post_type' => array('faq'),
  86. 'posts_per_page' => -1,
  87. );
  88. $cache_key = md5( serialize( $args ) );
  89. $cache_group = wp_cache_get_last_changed( 'posts' );
  90. $query = wp_cache_get( $cache_key, $cache_group);
  91. if($query === false){
  92. $query = new WP_Query($args);
  93. wp_cache_set( $cache_key, $query, $cache_group, 600 );
  94. }
  95. $items = [];
  96. if($query->have_posts()):
  97. $i = 0;
  98. while ($query->have_posts()): $query->the_post();
  99. global $post;
  100. ?>
  101. <li class="problem <?php echo $i == 0 ? 'focus': ''; ?>">
  102. <p class="question"><?php the_title( ) ?></p>
  103. <p class="answer">
  104. <?php echo $post->post_excerpt; ?>
  105. </p>
  106. </li>
  107. <?php
  108. $i++;
  109. endwhile;
  110. else:
  111. endif; ?>
  112. </ul>
  113. </div>
  114. <div class="block">
  115. <h3 class="block-title tac">Contact Us</h3>
  116. <p class="sub-title tac">
  117. Providing the best solutions for smart devices in Australia
  118. </p>
  119. <div class="flex-up-lg">
  120. <div class="apps">
  121. <a class="app" href="https://www.facebook.com/PTCAustralia" target="_blank"></a>
  122. <a class="app" href="https://www.linkedin.com/company/ptc-phone-tech-and-comm" target="_blank"></a>
  123. <a class="app" href="https://www.instagram.com/ptcshop_/" target="_blank"></a>
  124. </div>
  125. <div class="phone">
  126. <i class="phone-icon"></i>
  127. <div class="phone-number">
  128. <p>1300 000 349</p>
  129. <p>Mon - Fri : &nbsp;&nbsp;9:00 - 16:00</p>
  130. </div>
  131. </div>
  132. <!-- <button id="btn-book" class="block-btn">BOOK A REPAIR</button> -->
  133. <a class="block-btn" href="https://www.ptc.net.au/booking/" role="button">BOOK A REPAIR</a>
  134. </div>
  135. </div>
  136. <div class="block">
  137. <h3 class="block-title">Now over <?php echo $store_count; ?> stores across Australia</h3>
  138. <div class="flex-up-lg">
  139. <div class="store-list-wrap">
  140. <?php
  141. $len = ceil( count( $stores ) / 2 );
  142. $stores = array_chunk( $stores , $len);
  143. ?>
  144. <ul class="store-list">
  145. <?php
  146. foreach( $stores[0] as $item ){
  147. ?>
  148. <li class="store">
  149. <a href="<?php echo esc_url( $item['url'] ) ?>">
  150. <?php echo $item['name'] ?>
  151. </a>
  152. </li>
  153. <?php
  154. }
  155. ?>
  156. </ul>
  157. <ul class="store-list">
  158. <?php
  159. if(is_array( $stores[1] ) && !empty( $stores[1] )){
  160. foreach( $stores[1] as $item ){
  161. ?>
  162. <li class="store">
  163. <a href="<?php echo esc_url( $item['url'] ) ?>">
  164. <?php echo $item['name'] ?>
  165. </a>
  166. </li>
  167. <?php
  168. }
  169. } ?>
  170. </ul>
  171. </div>
  172. <a class="block-btn" href="https://www.ptc.net.au/store-locator/" role="button">Find the nearest store</a>
  173. </div>
  174. </div>
  175. </div>
  176. <?php get_template_part( 'part', 'footer' ) ?>
  177. </body>
  178. </html>