Wordpress: Output a custom post type list by two Custom Taxonomies -


i need list out custom post type organised 2 different taxonomies on these posts.

i have custom post type of properties/apartments taxonomies of location , type/size trying list them out below

required layout

required layout[1]

custom post type

apartment location

apartment size 1

  1. list item 1
  2. list item 2
  3. list item 3

apartment size 2

  1. list item 4
  2. list item 5
  3. list item 6

apartment location 2

apartment size 1

  1. list item 7
  2. list item 8
  3. list item 9

apartment size 2

  1. list item 10
  2. list item 11
  3. list item 12

i'm using current code it's spitting out under each taxonomy size? , cant filter location , size

          <?php       $terms = get_terms('apartment_location');       foreach( $terms $term ):       ?>       <h2><?php echo $term->name;?></h2>       <?php       $posts = get_posts(array(           'post_type' => 'apartments',           'taxonomy' => $term->taxonomy,           'term' => $term->slug,           'nopaging' => true       )); ?>                     <?php                     $terms = get_terms('apartment_type');                     foreach( $terms $term ):                     ?>                       <h3><?php echo $term->name;?></h3>                       <?php                       $posts = get_posts(array(                           'post_type' => 'apartments',                           'taxonomy' => $term->taxonomy,                           'term' => $term->slug,                           'nopaging' => true                       )); ?>                       <?php foreach($posts $post): setup_postdata($post); ?>                               <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a><br>                               <?php wp_reset_postdata();?>                       <?php endforeach; ?>                  <?php endforeach; ?>          <?php wp_reset_postdata();?>     <?php endforeach; ?> 


Comments

Popular posts from this blog

javascript - Clear button on addentry page doesn't work -

c# - Selenium Authentication Popup preventing driver close or quit -

tensorflow when input_data MNIST_data , zlib.error: Error -3 while decompressing: invalid block type -