Support

Account

Home Forums Bug Reports Relationship issue with tribe_events custom post type

Solved

Relationship issue with tribe_events custom post type

    • naires

    • October 9, 2014 at 10:12 pm

    Hi,

    I’m dealing with a strange issue involving:
    – ACF 4.3.9
    – Relationship ACField
    – The Events Calendar v3.8 (from Tribe)

    The issue is that when i choose (in the edit relationship field) to choose only the post type tribe_events, after when i’m in a post and i want to choose one tribe_events entrie, it doesn’t show all the events calendar posts… only shows less than half of the total events calendar entries.

    Anyone is also experience this issue?

    Best,

    • naires

    • October 10, 2014 at 1:23 am

    ok, i don’t how to fix this, but i at least i discovered the reason. Advanced Custom Field relationship only display the future events not the past events. Please note that this only happen when we choose to display only the post type tribe_events in the relationship field settings. There is a solution for this?

    • naires

    • October 12, 2014 at 8:22 pm

    ok i solved this issue. it’s simple and already documented in the plugin relatioship resources. i added a funtion in my funtions.php to add a new parameter to the query:

    function my_relationship_query( $args, $field, $post )
    {
        // add and define tribe events eventDisplay to 'all' since it's predifined only to future.
        $args['eventDisplay'] = 'all';
    
        return $args;
    }
    
    // acf/fields/relationship/result - filter for every field
    add_filter('acf/fields/relationship/query', 'my_relationship_query', 10, 3);
    
    • Florian

    • April 19, 2016 at 1:53 am

    Thank you for sharing. But it doesn’t work for me. Is this really exactly the function you use?
    ‘past’ does work, but then it doesn’t show the upcoming events. ‘all’ however has no effect..

    • Florian

    • April 19, 2016 at 10:01 pm

    All right. Figured it out.
    Anyone needs to solve this: “all” doesn’t work (anymore?) but “custom” does the job and shows all events (upcoming and past).

    Here’s the updated code:

    function my_relationship_query( $args, $field, $post )
    {
        // add and define tribe events eventDisplay to 'all' since it's predifined only to future.
        $args['eventDisplay'] = 'all';
    
        return $args;
    }
    
    // acf/fields/relationship/result - filter for every field
    add_filter('acf/fields/relationship/query', 'my_relationship_query', 10, 3);
    • elevate

    • December 17, 2019 at 6:06 am

    Hi,

    I’m using the latest from @florian-rosenbauer. I’ve tried it as it is changing the eventDisplay argument. And also start-date. But the filter isn’t working.

    Does anyone know if something has changed with ACF or Event Calendar?
    Do I need to call the filter differently if calling from a plugin?

Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.

We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.