Guest User

Untitled

a guest
Jun 20th, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. <?php
  2. $terms = get_terms( 'custom_taxonomy_slug' );
  3. if ( ! empty( $terms ) && ! is_wp_error( $terms ) ){
  4. foreach ( $terms as $term ) { ?>
  5.  
  6.  
  7. <?php echo $term->name ?>
  8.  <ul class="prod-list">
  9. <?php
  10. $args = array( 'posts_per_page' => -1, 'offset'=> 0, post_type => 'custom_post_slug', 'tax_query' => array(
  11. array(
  12. 'taxonomy' => 'custom_taxonomy_slug',
  13. 'field' => 'slug',
  14. 'terms' => $term->slug,
  15. ),
  16. ),
  17. );
  18. $myposts = get_posts( $args );
  19. foreach ( $myposts as $post ) : setup_postdata( $post ); ?>
  20.  
  21. <li><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></li>
  22.  
  23.  
  24. <?php
  25. endforeach;
  26. wp_reset_postdata();?>
  27. </ul>
  28.  
  29. <?php }
  30. } ?>
Add Comment
Please, Sign In to add comment