ACF Query = No Dates Pulling In

This topic contains 3 replies, has 2 voices, and was last updated by  Stephen Harris 10 years, 5 months ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #8270

    Hello,

    I have a WP loop creating rotator slides. Each slide is then connecting to a calendar event to get various calendar meta to show as text on top of the rotator.

    I’m using an Advanced Custom Fields relationship type field to make the connection, and it allows me to pull in the title and other data, but for whatever reason, when I try using eo_get_the_start(), it’s not returning anything. I double-checked, and it is being fed the post ID, so I don’t understand why it wouldn’t return a value if it does know what post to reference. Help?

    http://pastebin.com/DUmxJxYg

    Really stuck on this–help?

    Brent Barkley
    #8271

    Hi Brent,

    Does each $post in $posts = get_field('cf-rotator-rel'); contain an occurrence ID? Its not clear how the $posts being returned are generated…

    eo_get_the_start() requires the post ID and occurrence ID. However, if you’re just dealing with single events, then you can USE eo_get_schedule_start(), passing the post ID (technically it returns the start date of the first occurrence of the event).

    Stephen Harris
    #8275

    http://www.advancedcustomfields.com/resources/field-types/relationship/

    Based on what we’re seeing, maybe that’s the issue–the get_field(‘cf-rotator-rel) must not be getting the occurence ID. That said, it’s always going to be the first occurence of whatever I’m showing.

    Does the first occurence always get the same ID? I just tried 0 and 1, but still not getting anything returned, so if your answer is yes, then maybe that’s not the issue.

    BTW, eo_get_schedule_start() worked briliantly, so that at least bails me out. Thank you so much. But I am intersted to try to figure this issue out, as I see lots of ACF + EO combinations in the future and it would make my code cleaner to do it that way.

    • This reply was modified 10 years, 5 months ago by  Brent Barkley.
    Brent Barkley
    #8280

    The ID of the first occurrence could be anything – and so the likelihood is that there is no occurrence ID being passed. eo_get_schedule_start() gets you the first occurrence of any an event and eo_get_next_occurrence() gets you the next occurrence of an event (if it exists).

    How are values stored/assigned by get_field(‘cf-rotator-rel')? Are you entering post ID, or selecting by event title?

    Stephen Harris
Viewing 4 posts - 1 through 4 (of 4 total)
To enable me to focus on Pro customers, only users who have a valid license for the Pro add-on may post new topics or replies in this forum. If you have a valid license, please log-in or register an account using the e-mail address you purchased the license with. If you don't you can purchase one here. Or there's always the WordPress repository forum.