Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $terms = get_terms( 'custom_taxonomy_slug' );
- if ( ! empty( $terms ) && ! is_wp_error( $terms ) ){
- foreach ( $terms as $term ) { ?>
- <?php echo $term->name ?>
- <ul class="prod-list">
- <?php
- $args = array( 'posts_per_page' => -1, 'offset'=> 0, post_type => 'custom_post_slug', 'tax_query' => array(
- array(
- 'taxonomy' => 'custom_taxonomy_slug',
- 'field' => 'slug',
- 'terms' => $term->slug,
- ),
- ),
- );
- $myposts = get_posts( $args );
- foreach ( $myposts as $post ) : setup_postdata( $post ); ?>
- <li><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></li>
- <?php
- endforeach;
- wp_reset_postdata();?>
- </ul>
- <?php }
- } ?>
Add Comment
Please, Sign In to add comment