Advertisement
Guest User

Untitled

a guest
Dec 12th, 2017
206
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.54 KB | None | 0 0
  1. <?php
  2. /**
  3. * Template Name: Projects
  4. * @package clientcanvas
  5. */
  6.  
  7. get_header(); ?>
  8.  
  9. <main id="main" class="site-main" role="main">
  10. <?php get_template_part( 'template-parts/follow-us');?>
  11. <?php $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'single-post-thumbnail' ); ?>
  12. <section class="banner" style="background-image: url('<?php echo $image[0]; ?>');">
  13. <div class="message-wrap">
  14. <div class="message-wrap-headline">
  15. <h1><?php the_title(); ?></h1>
  16. <a href="#projects" class="scroll-cta"><i class="fa fa-long-arrow-down" aria-hidden="true"></i></a>
  17. </div>
  18. </div>
  19. </section>
  20. <section id="projects" class="dark-section welcome">
  21. <?php get_template_part( 'template-parts/grid');?>
  22. <div class="container-fluid">
  23. <h2 class="section-title dark block-reveal"><span><?php the_field('contact_intro_headline'); ?></span></h2>
  24. <div class="row">
  25. <div class="col-xs-12 map-sidebar animate">
  26. <h3>Projects by State</h3>
  27. <div class="map-tab">
  28. <input id="tab-one" type="checkbox" name="tabs">
  29. <label for="tab-one">Mississippi</label>
  30. <div class="tab-content">
  31. <?php
  32. $args = array(
  33. 'numberposts' => 100,
  34. 'post_type' => 'sfi_projects',
  35. 'meta_key' => 'project_state',
  36. 'meta_value' => 'Mississippi'
  37. );
  38. $the_query = new WP_Query( $args );
  39. ?>
  40. <?php if( $the_query->have_posts() ): ?>
  41. <?php while( $the_query->have_posts() ) : $the_query->the_post(); ?>
  42. <a href="<?php the_permalink(); ?>">
  43. <?php the_title(); ?>
  44. </a>
  45. <?php endwhile; ?>
  46. <?php endif; ?>
  47. <?php wp_reset_query(); // Restore global post data stomped by the_post(). ?>
  48. </div>
  49. </div>
  50. <div class="map-tab">
  51. <input id="tab-two" type="checkbox" name="tabs">
  52. <label for="tab-two">Louisiana</label>
  53. <div class="tab-content">
  54. <?php
  55. $args = array(
  56. 'numberposts' => 100,
  57. 'post_type' => 'sfi_projects',
  58. 'meta_key' => 'project_state',
  59. 'meta_value' => 'Louisiana'
  60. );
  61. $the_query = new WP_Query( $args );
  62. ?>
  63. <?php if( $the_query->have_posts() ): ?>
  64. <?php while( $the_query->have_posts() ) : $the_query->the_post(); ?>
  65. <a href="<?php the_permalink(); ?>">
  66. <?php the_title(); ?>
  67. </a>
  68. <?php endwhile; ?>
  69. <?php endif; ?>
  70. <?php wp_reset_query(); // Restore global post data stomped by the_post(). ?>
  71. </div>
  72. </div>
  73. </div>
  74. <div class="col-xs-12 animate">
  75. <div class="map-wrapper">
  76. <img src="/wp-content/themes/canvas/img/us-map.png" alt="United States Map">
  77.  
  78.  
  79. <?php
  80. // get taxonomy
  81.  
  82. $categories = get_categories('taxonomy=city&post_type=sfi_projects');
  83.  
  84. // get the current taxonomy term
  85. $term = get_queried_object();
  86.  
  87. // vars
  88. $image = get_field('project_city_image', $term);
  89. $top = get_field('map_point_top', $term);
  90. $left = get_field('map_point_left', $term);
  91. ?>
  92. <ul>
  93. <?php foreach ($categories as $category) : ?>
  94. <li class="map-marker" style="left:<?php echo $left; ?>%; top:<?php echo $top; ?>%">
  95. <a href="<?php echo get_category_link($category->cat_ID); ?>"><?php echo $category->name; ?></a>
  96. <img src="<?php echo $image['url']; ?>">
  97. </li>
  98. <?php endforeach; ?>
  99. <ul>
  100.  
  101. </div>
  102. </div>
  103. </div>
  104. </div>
  105. </section>
  106. </main>
  107.  
  108. <?php get_footer(); ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement