Event custom meta fields for WP_Query

Home Forums Calendar Products Events Calendar PRO Event custom meta fields for WP_Query

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #1231764
    Joshua
    Participant

    Hello,

    I couldn’t find this in the docs or elsewhere: is there a list of all of the custom meta fields associated with an event.

    I’m using a custom WP_Query and want to grab and display the following:

    – start date
    – location/address
    – description
    – excerpt
    …etc.

    How would I go about doing that? I only want some pieces of the event(s) for certain areas which is why I went with using WP_Query.

    Is start date just ‘start_date’? And likewise ‘end_date’? What date format id that in or is it a date object at all?

    Best,

    Joshua

    #1232502
    Cliff
    Member

    Hi, Joshua.

    Please reference these:

    and let me know if you have any follow-up questions.

    #1232610
    Joshua
    Participant

    Thanks for this. What was tripping me up was that _EventStartDate is just a string so I had to convert it into a datetime object to work with it like so:

    <?php
    $start = get_post_meta( get_the_ID(), '_EventStartDate', true );

    date_default_timezone_set('America/Chicago');

    $date = date("M n", strtotime($start));

    echo '‘ . $date . ‘‘;
    ?>

    Joshua Michaels
    studio.bio
    web development | UI/UX design | wordpress | design | branding | e-commerce | interactive

    #1233113
    Cliff
    Member

    It depends where and when you’re trying to use this, but you may be interested in using event_start_timestamp() from /wp-content/plugins/the-events-calendar/src/Tribe/Timezones.php

    Or tribe_format_date(), which uses date_i18n().

    Anyway, let me know if I can be of further help.

    #1249470
    Support Droid
    Keymaster

    Hey there! This thread has been pretty quiet for the last three weeks, so we’re going to go ahead and close it to avoid confusion with other topics. If you’re still looking for help with this, please do open a new thread, reference this one and we’d be more than happy to continue the conversation over there.

    Thanks so much!
    The Events Calendar Support Team

Viewing 5 posts - 1 through 5 (of 5 total)
  • The topic ‘Event custom meta fields for WP_Query’ is closed to new replies.