Posts 2 Posts
Having trouble with loop and the_title showing up (1 post)

  1. hept27
    Posted 3 years ago #

    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.

    $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(); ?>
    	// Display connected clients
    	foreach ( $post->clients as $post ) : setup_postdata( $post );
    		echo '<p>clients:</p>';
    		echo the_title();


Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Posts 2 Posts
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic