Quantcast
Channel: Topic Tag: plugin | WordPress.org
Viewing all articles
Browse latest Browse all 26892

Andrew.Bloom on "[Plugin: Posts 2 Posts] Using P2P Results to Display Another P2P Connection"

$
0
0
$my_query = new WP_Query( array(
		'post_type' => array(
					'products',
					'brands',
					'distributors'
				) )
			);

p2p_type( 'products_to_brands' )->each_connected( $my_query, array(), 'brands' );

while ( $my_query->have_posts() ) : $my_query->the_post();

	// Another level of nesting
	p2p_type( 'brands_to_distributors' )->each_connected( $post->brands, array(), 'distributors' );

	foreach ( $post->brands as $post ) : setup_postdata( $post );
		echo '<h3>Connected Distro</h3>';

		foreach ( $post->distributors as $post ) : setup_postdata( $post );
			the_title();
		endforeach;
	endforeach;

	wp_reset_postdata();
endwhile;

I used an example, still no output.

I know I'm doing something wrong. I'm going to continue working on it until I get it right.


Viewing all articles
Browse latest Browse all 26892

Trending Articles