Listing all custom post type items for each CPT-onomy item
I have this loop, below, in an rchive page, which works great to output all the Publications (custom post type) for a particular Artist (a CPT-onomy), using the archive rewrites described in the documentation.
How would I use and modify such a loop on a custom Page to lists all Publications for all Artists that have publications, separated by Artist headings?
I didn’t see a similar example in the documentation or another thread that quite illustrates how to structure such a “for each” setup based on a CPT-onomy.
<?php if ( have_posts() ) : ?> <?php $args = array( 'post_type' => 'publications', 'posts_per_page' => -1 ); $loop = new WP_Query( $args ); while ( $loop->have_posts() ) : $loop->the_post(); ?> <div class="pubItem"> <a href="<?php the_permalink() ?>"><?php the_post_thumbnail( 'publication-thumb' ); ?> <? the_title(); ?> <? the_content(); ?> </a> </div> <?php endwhile; ?> <?php else : ?> <?php endif; ?>
- The topic ‘Listing all custom post type items for each CPT-onomy item’ is closed to new replies.