Created
December 11, 2011 18:21
-
-
Save jrstaatsiii/1461923 to your computer and use it in GitHub Desktop.
Attempt at Post 2 Post
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<h2>Technology</h2> | |
<ul> | |
<?php | |
//Target The Client CPT & Taxonomy | |
$technology_args = array( | |
'post_type' => 'client', | |
'order_by' => 'title', | |
'order' => 'ASC', | |
'posts_per_page' => '-1', | |
'tax_query' => array( | |
array( | |
'taxonomy' => 'industry-type', | |
'field' => 'slug', | |
'terms' => 'technology' | |
) | |
) | |
); | |
//Setup The Query | |
$technology_query = new WP_Query( $technology_args ); | |
//Check to see if there is a relationship between a client and a case study | |
p2p_type( 'clients_to_case_studies' )->each_connected( $technology_query ); | |
//The Loop | |
while( $technology_query->have_posts() ) : $technology_query->the_post(); | |
?> | |
<?php if( !empty( $post->connected ) ) { ?> | |
<li> | |
<?php the_title(); ?> | |
<?php p2p_list_posts( $post->connected ); ?> | |
</li> | |
<?php } else { ?> | |
<li> | |
<?php the_title(); ?> | |
<p>not connected</p> | |
</li> | |
<?php } ?> | |
<?php endwhile; wp_reset_query(); ?> | |
</ul> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment