Title: [Plugin: Posts 2 Posts] Ordering/ displaying via taxonomy term?
Last modified: August 20, 2016

---

# [Plugin: Posts 2 Posts] Ordering/ displaying via taxonomy term?

 *  [trickadee](https://wordpress.org/support/users/trickadee/)
 * (@trickadee)
 * [14 years, 3 months ago](https://wordpress.org/support/topic/plugin-posts-2-posts-ordering-displaying-via-taxonomy-term/)
 * Hi there,
    I love this plugin- it is so useful for what I’m trying to do. Thank
   you!
 * I have two issues which I’ll separate into different posts.
 * Firstly, I’ve managed to connect posts and display them- it’s all fabulous. I
   now want to sort and display my associated resources for the user by a Taxonomy.
 * The connected posts displayed on the CPT page ‘Training Modules’ are a CPT called‘
   Associated Resources’ which has a taxonomy attached to it called ‘File Types’-
   registered using the Ultimate Taxonomy Manager plugin. The user selects file 
   types such as ‘Document- handout’, ‘Document-slide’, ‘Video’ etc…
 * I want to cluster the Associated Resources by file type (taxonomy term name) 
   in a list below the post. I have the list- which looks great, but I’m not sure
   how to sort them so all videos are together, all documents are together, etc…
 * This is what I have now:
 *     ```
       <?php
       // Find connected pages
       $connected = new WP_Query( array(
         'connected_type' => 'resources_to_training_module',
         'connected_items' => get_queried_object_id(),
       ) );
   
       // Display connected pages
       if ( $connected->have_posts() ) :
       ?>
   
       <?php while ( $connected->have_posts() ) : $connected->the_post(); ?>
       	<tr style="vertical-align: middle; font-size: 0.7em;"><td>
       	<a href="<?php the_field('link'); ?>"><img src="<?php echo do_shortcode( '[xy_file_types field="file_type_icon"]' ) ?>" width="40" height="40" /></a></br>
       	<a href="<?php the_field('link'); ?>"> Download </a>
       	</td>
       	<td><strong><?php the_title(); ?></strong><br/><?php the_field('description'); ?></td>
       	<td class="post_entry_comment_option">			<div class="comments-link">
       				<?php comments_popup_link( '<span class="leave-reply">' . __( 'Reply', 'twentyeleven' ) . '</span>', _x( '1', 'comments number', 'twentyeleven' ), _x( '%', 'comments number', 'twentyeleven' ) ); ?>
       			</div><br/>			<div class="comments-more"><a href="<?php the_permalink(); ?>"> More...</a></div></td></tr>
       <?php endwhile; ?>
       ```
   
 * [http://wordpress.org/extend/plugins/posts-to-posts/](http://wordpress.org/extend/plugins/posts-to-posts/)

Viewing 1 replies (of 1 total)

 *  [Manuel Schmalstieg](https://wordpress.org/support/users/targz-1/)
 * (@targz-1)
 * [14 years, 2 months ago](https://wordpress.org/support/topic/plugin-posts-2-posts-ordering-displaying-via-taxonomy-term/#post-2582151)
 * It may not be the most elegant or peformance-optimized method, but as a last 
   resort you could run several queries, one after the other, each targetting a 
   specific taxonomy.
 * Something like this:
 *     ```
       $connected_custom = new WP_Query( array(
         'connected_type' => 'stuff_to_posts',
         'connected_items' => get_queried_object_id(),
         'post_type' => 'my_freaking_post_type',
         'orderby' => 'date',
         'order' => 'ASC',
         'tax_query' => array(
           array(
             'taxonomy' => 'my_taxonomy',
             'field' => 'slug',
             'terms' => 'my_term',
             //'operator' => 'NOT IN'
             )
           ),
       ) );
       ```
   

Viewing 1 replies (of 1 total)

The topic ‘[Plugin: Posts 2 Posts] Ordering/ displaying via taxonomy term?’ is closed
to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/posts-to-posts_7a8e9d.svg)
 * [Posts 2 Posts](https://wordpress.org/plugins/posts-to-posts/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/posts-to-posts/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/posts-to-posts/)
 * [Active Topics](https://wordpress.org/support/plugin/posts-to-posts/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/posts-to-posts/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/posts-to-posts/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [Manuel Schmalstieg](https://wordpress.org/support/users/targz-1/)
 * Last activity: [14 years, 2 months ago](https://wordpress.org/support/topic/plugin-posts-2-posts-ordering-displaying-via-taxonomy-term/#post-2582151)
 * Status: not resolved