WordPress.org

Ready to get started?Download WordPress

Forums

Posts 2 Posts
Display Multiple Connections Intermingled (2 posts)

  1. jsing
    Member
    Posted 1 year ago #

    I have 3 post types, cases, research, interviews. Both research and interviews are connected to cases, but not to each other.

    On the single-case page I want to display both research and interviews that are connected to it, but they need to display together by the publish date. For instance:

    CASE: 123
    Interview Title 1/10/13
    -Interview Content
    Research Title 1/11/13
    -Research Content
    Interview Title 1/14/13
    -Interview Content
    Research Title 1/22/13
    -Research Content
    Interview...

    Is this even possible? I have no problem getting them to display separately but inline is a no go. I have tried :

    // Find connected posts
    $connected = new WP_Query( array(
      'connected_type' => array(
          'interview_to_cases',
          'research_to_cases',
      ),
      'connected_items' => get_queried_object(),
      'nopaging' => true,
      'orderby' => 'date',
      'order' => 'ASC',
    ) );

    and something like:

    $my_query = new WP_Query( array(
    	'connected_items' => get_queried_object(),
    	'nopaging' => true,
      	'orderby' => 'date',
      	'order' => 'ASC',
    ) );
    
    p2p_type( 'research_to_cases' )->each_connected( $my_query, array(), 'research' );
    
    p2p_type( 'interview_to_cases' )->each_connected( $my_query, array(), 'interview' );

    I guess what I need is to get two connected_type into a single loop so it can display them in date order as though they were a single connection.

    Again, I don't know if this is even possible or if I am just thinking about it wrong, any help would be appreciated.

    http://wordpress.org/extend/plugins/posts-to-posts/

  2. Eric
    Member
    Posted 1 year ago #

    I am having a similar issue. In my case I have authors who write articles and authors who write recipes. So authors are connected with both articles and recipes, but I'd like to create one intermingled date-sorted list of both their articles and their recipes to show on the author page.

    Just like @jsing, I have no problem producing two independent lists on the author page, but have had no luck getting those lists to intermingle.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic