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

I got it now, took a look at some older posts in this support forum.

Made a temporary ID number for the query to work off of:

<?php
$wp_query = new WP_Query( array(
  'connected_type' => 'products_to_brands',
  'connected_items' => get_queried_object(),
  'nopaging' => true,
) );

if ( $wp_query->have_posts() ) :

	$temp_brand_ID = "";

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

	$temp_brand_ID = get_the_ID();

$connected = new WP_Query( array(
	'connected_type' => 'brands_to_distributors',
	'connected_items' => $temp_brand_ID,
	'nopaging' => true,
	'orderby' => 'title',
	'order' => 'ASC'
) );
?>
<h2>Distributors:</h2>
<ul>
<? while ( $connected->have_posts() ) : $connected->the_post(); ?>
	<li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
<? endwhile; ?>
</ul>
	<?

endwhile;
	wp_reset_postdata();
endif;
?>

Viewing all articles
Browse latest Browse all 26892

Trending Articles