Support Forum
Support › MB Relationships › Trying to display all the possible connection to a post › Reply To: Trying to display all the possible connection to a post
I can get it to work like this:
$connected_conf2pub = new WP_Query( array(
'relationship' => array(
'id' => 'conf2pub',
'to' => get_the_ID(), // You can pass object ID or full object
),
'nopaging' => true,
) );
while ( $connected_conf2pub->have_posts() ) : $connected_conf2pub->the_post();
echo 'Connected Conf: <a href="' . get_permalink($post->ID) . '"><p>' . get_the_title($post->ID) . '</p></a>';
endwhile;
wp_reset_postdata();
$connected_post2pub = new WP_Query( array(
'relationship' => array(
'id' => 'post2pub',
'to' => get_the_ID(), // You can pass object ID or full object
),
'nopaging' => true,
) );
while ( $connected_post2pub->have_posts() ) : $connected_post2pub->the_post();
echo 'Connected Posts: <a href="' . get_permalink($post->ID) . '"><p>' . get_the_title($post->ID) . '</p></a>';
endwhile;
wp_reset_postdata();
$connected_pub2press = new WP_Query( array(
'relationship' => array(
'id' => 'pub_and_press',
'from' => get_the_ID(), // You can pass object ID or full object
),
'nopaging' => true,
) );
while ( $connected_pub2press->have_posts() ) : $connected_pub2press->the_post();
echo 'Connected Press: <a href="' . get_permalink($post->ID) . '"><p>' . get_the_title($post->ID) . '</p></a>';
endwhile;
wp_reset_postdata();
But would like to be able to display all the connections as one for design purposes. I don't really need to identify what's what, I just want to display all connections in date order.