• Benito

    (@ben_aliarteo)


    Hi,
    Thank you for this great plugin ! very nice work !
    I’m using a custom post type for my event (with the basic date) and
    When I do my relation between agencies and events, future events are ignored.
    Is there a way to do the relation ignoring the unpublish status of one of my custom post type event ?
    I think that it’s just an option, but I can’t find where it is …
    tks for your help
    regards

    https://www.ads-software.com/plugins/posts-to-posts/

Viewing 7 replies - 1 through 7 (of 7 total)
  • Elías

    (@eliasgdj)

    I think this is a default behaviour of WP_Query. You have to add the status parameter to the query.

    https://codex.www.ads-software.com/Class_Reference/WP_Query#Status_Parameters

    The code might look like this:

    $connected = new WP_Query( array(
      'connected_type' => 'posts_to_pages',
      'connected_items' => get_queried_object(),
      'nopaging' => true,
      'status' => array('publish','future')
    ) );
    Elías

    (@eliasgdj)

    Wait I think your problem is when connecting, not when displaying. I think you have to use the p2p_connectable_args filter. I can’t give you more help ??

    Hi EliasNS,

    I got the same issue.
    Your plugin do the sql query by post_status ‘publish’ or ‘private’.
    I’d also like to make the query by post_status = ‘future’.
    How can I achieve this?

    Thanks

    Hi Fibiuz.

    I’m not the developer of the plugin, ?I wish!

    Since I am simply a apprentice on PHP and I only get things working with a lot of reading and testing. I only can refer you to my previous messages on this thread, I can’t help anymore, I’m sorry ??

    Well, I can leave here the URL for the filters sections on the documentation

    Good luck!

    Hi EliasNS

    Thank you anyway for your support.
    I was not able to fix the problem by using “p2p_connectable_args”
    I solved this issue by creating a custom query which allows to get any type of post connected.

    Cheers ??

    Thread Starter Benito

    (@ben_aliarteo)

    Hi, tks for your replies,

    In my case, i decided to create a date metabox for my custom content, …

    so I’m not using the future plugin anymore for that,

    regards

    Fibiuz, the type of post for a connection is defined when creating the connection.

    Good solution Ben, one date for the post itself, and another for the date of the event.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Future Post and relation’ is closed to new replies.