• Resolved djrowan

    (@djrowan)


    I have an events engine that has future events. How can I tell p2p to return posts in the future only?
    I tried this:
    $connected = new WP_Query( array(
    ‘connected_type’ => ‘event_artists’,
    ‘connected_items’ => get_queried_object_id(),
    ‘post_status’ => ‘future’
    ) );

    I have it working on this for a while and just figured out why it wasn’t returning any results! Future posts!
    Please help me out here!
    Thanks
    Rowan

    http://ww.wp.xz.cn/extend/plugins/posts-to-posts/

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

    (@scribu)

    First try getting all future events:

    $connected = new WP_Query( array(
    'post_type' => 'event',
    'post_status' => 'future',
    ) );

    If that works, then add the ‘connected_’ parameters.

    Thread Starter djrowan

    (@djrowan)

    Hey Scribu,
    Thanks for the reply.

    This works to get future entries:
    $connected = new WP_Query( array(
    ‘post_status’ => ‘future’,
    ) );

    This fails to return any results:
    $connected = new WP_Query( array(
    ‘post_status’ => ‘future’,
    ‘connected_type’ => ‘event_artists’,
    ‘connected_items’ => get_queried_object_id()
    ) );

    WHOOHOO .. i just cracked it. I was missing the ‘connected_direction’ parameter.

    Here’s my successful query for future events:
    $connected = new WP_Query( array(
    ‘post_status’ => ‘future’,
    ‘connected_type’ => ‘event_artists’,
    ‘connected_items’ => get_queried_object_id(),
    ‘connected_direction’ => ‘any’
    ) );

    Thank you for helping me work through that one. That took a LONG time to figure out, but I’m stoked to have it now.

    cheers
    rowan

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘[Plugin: Posts 2 Posts] Posts connected to Future Posts’ is closed to new replies.