I have a basic loop (a rough example of what I'm doing) of work, and want to show the client(s) the work was done for. Some work has clients connected and some doesn't. The work that doas have one or more client associated with it echos the clients paragraph, and echos it once for each connect client, so it is recognizing the connections. But it doesn't echo the title, and I cant't seem to figure out why.
<?php $my_query = new WP_Query( array( 'post_type' => 'work' ) ); p2p_type( 'work_for_client' )->each_connected( $my_query, array(), 'clients' ); while ( $my_query->have_posts() ) : $my_query->the_post(); ?> <?php the_title(); ?> <?php // Display connected clients foreach ( $post->clients as $post ) : setup_postdata( $post ); echo '<p>clients:</p>'; echo the_title(); endforeach; wp_reset_postdata(); ?>