Returning the start date using tribe_get_start_date

Home Forums Calendar Products Events Calendar PRO Returning the start date using tribe_get_start_date

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #974806
    Philip Macaulay
    Participant

    Hi

    I’m trying to use the following code to get the event start date into a Gravity Form:

    add_filter('gform_field_value_event_date', 'my_custom_population_function');
    function my_custom_population_function($value){
        return tribe_get_start_date(null, false, 'F j, Y - g:i a');
    }

    But it brings in the date the form is returned ie today’s date rather than the event date in August.

    I’ve seen a few issues around this both here in the forum and elsewhere where the tribe_get_start_date returns are similar to above.
    Is there something else I need to do to get this to work – sorry, I’m getting there with my php, but still really a novice.

    Any help would be gratefully appreciated.

    Thanks Phil

    #975171
    Nico
    Member

    Hey Phil,

    Glad to be helping you out on this too!

    First parameter of tribe_get_start_date sets the event from which to extract the date. If this is set to NULL, it will use global $post (current post ID), so that’s why you are getting an unexpected result.

    Can you try to hook in the event ID there?

    return tribe_get_start_date($your_event_ID, false, 'F j, Y - g:i a')

    Maybe for testing this out you can manually set that value to see if this is working fine.

    Please let me know if this helps you getting around the issue,
    Best,
    Nico

    #985728
    Philip Macaulay
    Participant

    Hi Nico

    You can close this thread as I have resolved…. Thanks

    #985868
    Nico
    Member

    Hi Phil,

    Glad to hear 🙂 I’m closing this topic then – but as always please don’t hesitate to create new topics if you need help with anything else.

    Best,
    Nico

Viewing 4 posts - 1 through 4 (of 4 total)
  • The topic ‘Returning the start date using tribe_get_start_date’ is closed to new replies.