Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $_terms = get_terms( array('property_location') );
- // $_terms = get_terms( array('apartment_type') );
- foreach ($_terms as $term) :
- $term_slug = $term->slug;
- $_posts = new WP_Query( array(
- 'post_type' => 'property',
- 'posts_per_page' => 20, //important for a PHP memory limit warning
- 'tax_query' => array(
- array(
- 'taxonomy' => 'property_location',
- 'field' => 'slug',
- 'terms' => $term_slug,
- ),
- ),
- ));
- if( $_posts->have_posts() ) : ?>
- <div class="property">
- <?php echo '<h3>'. $term->name .'</h3><hr />';
- while ( $_posts->have_posts() ) : $_posts->the_post();
- $title = get_field('title');
- $navtitle = get_field('navigation_title');
- $content = get_field('content');
- $terms = get_the_terms( $post->ID, 'property_type' );
- $location = get_the_terms( $post->ID, 'property_location' );
- ?>
- <a href='#<?php echo $navtitle; ?>'>
- <?php the_title(); ?>
- </a>
- <?php
- endwhile; ?>
- </div>
- <?php endif;
- wp_reset_postdata();
- endforeach;
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement