Advertisement
Guest User

Untitled

a guest
Mar 27th, 2017
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.48 KB | None | 0 0
  1. <?php
  2. $_terms = get_terms( array('property_location') );
  3.  
  4. // $_terms = get_terms( array('apartment_type') );
  5. foreach ($_terms as $term) :
  6. $term_slug = $term->slug;
  7. $_posts = new WP_Query( array(
  8. 'post_type' => 'property',
  9. 'posts_per_page' => 20, //important for a PHP memory limit warning
  10. 'tax_query' => array(
  11. array(
  12. 'taxonomy' => 'property_location',
  13. 'field' => 'slug',
  14. 'terms' => $term_slug,
  15. ),
  16. ),
  17. ));
  18. if( $_posts->have_posts() ) : ?>
  19. <div class="property">
  20. <?php echo '<h3>'. $term->name .'</h3><hr />';
  21.  
  22. while ( $_posts->have_posts() ) : $_posts->the_post();
  23.  
  24. $title = get_field('title');
  25. $navtitle = get_field('navigation_title');
  26. $content = get_field('content');
  27. $terms = get_the_terms( $post->ID, 'property_type' );
  28. $location = get_the_terms( $post->ID, 'property_location' );
  29.  
  30. ?>
  31. <a href='#<?php echo $navtitle; ?>'>
  32. <?php the_title(); ?>
  33. </a>
  34. <?php
  35. endwhile; ?>
  36. </div>
  37. <?php endif;
  38. wp_reset_postdata();
  39.  
  40. endforeach;
  41. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement