Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author scribu

    (@scribu)

    Not sure what you mean by ‘simultaneously’.

    It also depends if the relationship is:

    post_A - post_B - user

    or

    post_A - post_B
    post_A - user
    Thread Starter MoBlaise

    (@moblaise)

    I have 2 different post types, say posts A and posts B.

    They are connected.

    But posts B are also connected to users.

    Now, for each post A I want to list all connected posts B, and users connected to each of those B posts.

    Plugin Author scribu

    (@scribu)

    Well, something like this should work:

    $connected_B = new WP_Query( array(
      'connection_type' => 'A-TO-B',
      'connected_items' => $post_A
    ) );
    
    p2p_type( 'B-TO-USER' )->each_connected( $connected_B );

    The trouble is that each_connected() doesn’t work for posts-to-users connections yet.

    Thread Starter MoBlaise

    (@moblaise)

    I’m not sure I understand… so this won’t work at the moment? If it will, could you let me know how the rest of the code should look like, how to finish the loop, I’m a bit lost here…

    Plugin Author scribu

    (@scribu)

    It now works in the development version (1.1.5-alpha).

    You’ll find a complete usage example for each_connected() in the wiki:

    https://github.com/scribu/wp-posts-to-posts/wiki/Looping-The-Loop

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘[Plugin: Posts 2 Posts] posts 2 users’ is closed to new replies.