Guest User

Family

a guest
Jan 12th, 2023
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.88 KB | None | 0 0
  1. <?php
  2. /**
  3. * Template Name: Family services Page
  4. * The template for displaying pages
  5. *
  6. * This is the template that displays all pages by default.
  7. * Please note that this is the WordPress construct of pages and that
  8. * other "pages" on your WordPress site will use a different template.
  9. *
  10. * @package WordPress
  11. * @subpackage sinda
  12. */
  13. get_header();
  14. ?>
  15.  
  16. <body>
  17. <?php include(get_template_directory() . "/menu.php"); ?>
  18. <!-- Banner
  19. ================================================== -->
  20. <div class="slider_page_container">
  21. <!-- Get from post type: banner -->
  22. <?php
  23. $args = array('post_type' => 'banner', 'tax_query' => array(
  24. array(
  25. 'taxonomy' => 'banner_type', //or tag or custom taxonomy
  26. 'field' => 'slug',
  27. 'terms' => array('parenting')
  28. )
  29. ));
  30. $loop = new WP_Query($args);
  31. while ($loop->have_posts()) : $loop->the_post();
  32. //$feat_image = wp_get_attachment_url(get_post_thumbnail_id($post->ID));
  33. $feat_image = wp_get_attachment_image_src($post->banner_photo, 'full');
  34. $feat_image_mt = wp_get_attachment_image_src($post->banner_mobile_n_tablet, 'full');
  35.  
  36. $useragent = $_SERVER['HTTP_USER_AGENT'];
  37.  
  38. if($post->banner_link != ''){
  39. echo '<a href="' . $post->banner_link . '">';
  40. }
  41.  
  42. if (strpos($useragent, 'iPad') !== false || strpos($useragent, 'Mobile') !== false) {
  43. if ($feat_image_mt[0] != "") {
  44. echo '<img src="' . $feat_image_mt[0] . '"/>';
  45. } else {
  46. echo '<img src="' . $feat_image[0] . '"/>';
  47. }
  48. } else {
  49. echo '<img src="' . $feat_image[0] . '"/>';
  50. }
  51.  
  52. if($post->banner_link != ''){
  53. echo '</a>';
  54. }
  55. endwhile;
  56. ?>
  57. </div>
  58. <!-- /.Banner -->
  59.  
  60. <div class="clearfix"></div>
  61.  
  62. <!-- START EDUCATIONS -->
  63. <div class="container listing_page_wrapper" data-aos="fade-up">
  64. <img src="<?php echo get_template_directory_uri(); ?>/imgs/icon-parenting-black.png"/>
  65.  
  66. <?php
  67. $post = get_post("24");
  68. $content = apply_filters('the_content', $post->post_content);
  69. echo '<h1>'.strtoupper($post->post_title) .'</h1>';
  70. echo '<hr class="h1_underline">';
  71. echo $content;
  72. ?>
  73. </div>
  74. <!-- /END EDUCATIONS -->
  75.  
  76.  
  77. <!-- START OUR STORY-->
  78. <?php
  79. //list terms in a given taxonomy
  80. $taxonomy = 'family_type';
  81. $tax_terms = get_terms($taxonomy, array('orderby' => 'id'));
  82.  
  83. if (count($tax_terms) > 0) {
  84. ?>
  85.  
  86. <div class="container-fluid card-alt-bg" data-aos="fade-up">
  87. <div class="container educations_landing_wrapper">
  88. <div class="current_education_pager" data-expand="false" data-currentindex="0">
  89. <?php
  90.  
  91. foreach ($tax_terms as $tax_term) {
  92. echo strtoupper($tax_term->name);
  93. break;
  94. }
  95. ?>
  96. </div>
  97. <div id="bx-pager-educations">
  98.  
  99. <?php
  100. $iCount = 0;
  101. foreach ($tax_terms as $tax_term) {
  102. echo '<a data-slide-index="' . $iCount . '" href="javascript:void(0);" data-menutext="' . strtoupper($tax_term->name) . '">' . strtoupper($tax_term->name) . '</a>';
  103. $iCount++;
  104. }
  105. ?>
  106.  
  107. </div>
  108.  
  109. <ul class="bxslider_educations">
  110. <?php
  111. //list terms in a given taxonomy
  112. $tax_terms = get_terms($taxonomy, array('orderby' => 'id'));
  113.  
  114. foreach ($tax_terms as $tax_term) {
  115. echo '<li>';
  116. echo '<div class="container container_bxslider_educations">';
  117.  
  118. //$args = array('post_type' => 'family','posts_per_page'=>-1);
  119. $args = array('post_type' => 'family', 'posts_per_page' => -1, 'orderby'=>'menu_order title','order'=> 'ASC','tax_query' => array(
  120. array(
  121. 'taxonomy' => $taxonomy, //or tag or custom taxonomy
  122. 'field' => 'slug',
  123. 'terms' => array($tax_term->slug)
  124. )
  125. ));
  126.  
  127. $loop = new WP_Query($args);
  128. while ($loop->have_posts()) : $loop->the_post();
  129. //$feat_image = wp_get_attachment_url(get_post_thumbnail_id($post->ID));
  130.  
  131. $photoArr = wp_get_attachment_image_src($post->thumbnail_image, 'full');
  132.  
  133. $hoverdetail = get_post_meta($post->ID, 'hover_detail', true);
  134. $registration_status = get_post_meta($post->ID, 'registration_status', true);
  135. $closing_date = get_post_meta($post->ID, 'closing_date', true);
  136.  
  137. if ($registration_status == "close" || ($closing_date != '' && time() > strtotime($closing_date)) ) {
  138. echo '<div class="education_entry reg_close" style="background-image:url(\'' . $photoArr[0] . '\')">';
  139. } else {
  140. echo '<div class="education_entry" style="background-image:url(\'' . $photoArr[0] . '\')">';
  141. }
  142.  
  143. echo '<a href="' . get_permalink($post->ID) . '">';
  144. echo '<img src="' . $photoArr[0] . '"/>';
  145. echo '<span class="intro pinkred">' . $post->post_title . '</span>';
  146.  
  147. if ($registration_status == "close" || ($closing_date != '' && time() > strtotime($closing_date)) ) {
  148. echo '<span class="detailclose">REGISTRATION CLOSED</span>';
  149. } else {
  150. echo '<span class="detail pinkred"><div class="hover-detail-inner">' . $hoverdetail . '</div></span>';
  151. }
  152.  
  153. echo '</a>';
  154. echo '</div>';
  155.  
  156. endwhile;
  157. echo "</div>";
  158. echo "</li>";
  159. }
  160. ?>
  161.  
  162.  
  163. </ul>
  164.  
  165.  
  166. </div>
  167. </div>
  168. <!-- /END OUR STORY -->
  169.  
  170. <?php } ?>
  171.  
  172.  
  173. <?php get_footer(); ?>
  174. <script type="text/javascript">
  175. $(document).ready(function () {
  176. if (/Android|webOS|iPhone|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) {
  177. slider = $('.bxslider_educations').bxSlider();
  178. slider.destroySlider();
  179.  
  180. var startSlide = 0;
  181. var tab = getUrlParameter("tab");
  182. if (tab == 60){
  183. //Children
  184. startSlide =0;
  185. }else if (tab==61){
  186. //Parenting
  187. startSlide =1;
  188.  
  189. }else{
  190. startSlide = 0;
  191. }
  192.  
  193. if (startSlide > 0) {
  194. var selected_data = $("#bx-pager-educations").find("[data-slide-index=" + startSlide + "]");
  195. var selected_slide_index =selected_data.data('slide-index');
  196. var selected_menutext = selected_data.data('menutext');
  197.  
  198.  
  199. $('.bxslider_educations li').each(function (i, obj) {
  200. if (i != selected_slide_index) {
  201. $(this).hide();
  202.  
  203. }
  204. else {
  205. $(this).show();
  206. $(".current_education_pager").text(selected_menutext);
  207. }
  208.  
  209. });
  210. }
  211. } else {
  212. var tab = getUrlParameter("tab");
  213. var startSlide=0;
  214. if (tab == 60){
  215. //Children
  216. startSlide =0;
  217. }else if (tab==61){
  218. //Parenting
  219. startSlide =1;
  220.  
  221. }else{
  222. startSlide = 0;
  223. }
  224.  
  225. $('.bxslider_educations').bxSlider({
  226. pagerCustom: '#bx-pager-educations',
  227. controls: false,
  228. startSlide: startSlide
  229. });
  230.  
  231. $("#bx-pager-educations_remove a").click(function () {
  232. var animationName = "rubberBand";
  233. var animationEnd = 'webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend';
  234. $(".education_entry").addClass('animated bounceIn').one(animationEnd, function () {
  235. $(".education_entry").removeClass('animated bounceIn');
  236. //console.log("in");
  237. });
  238. //console.log("end");
  239. });
  240. }
  241.  
  242.  
  243. });
  244.  
  245. var getUrlParameter = function getUrlParameter(sParam) {
  246. var sPageURL = decodeURIComponent(window.location.search.substring(1)),
  247. sURLVariables = sPageURL.split('&'),
  248. sParameterName,
  249. i;
  250.  
  251. for (i = 0; i < sURLVariables.length; i++) {
  252. sParameterName = sURLVariables[i].split('=');
  253.  
  254. if (sParameterName[0] === sParam) {
  255. return sParameterName[1] === undefined ? true : sParameterName[1];
  256. }
  257. }
  258. };
  259. </script>
  260. </body>
  261. </html>
Advertisement
Add Comment
Please, Sign In to add comment