[Plugin: Posts 2 Posts] Ordering/ displaying via taxonomy term?
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; ?>
- The topic ‘[Plugin: Posts 2 Posts] Ordering/ displaying via taxonomy term?’ is closed to new replies.