Is there a way to get the post ID of the event?

Home Forums Calendar Products Events Calendar PRO Is there a way to get the post ID of the event?

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #78243
    parkwaypartners
    Participant

    hi – I’m trying to wrangle a way to display the first date only of recurring events in the calendar view, and I think I could cobble something together with javascript if I could find a way to isolate the post ID of the recurring event. I see that it creates a class name of post-xxxx – is there a way I can call that class name up on it’s own?

    Thanks!
    Erin

    #78280
    parkwaypartners
    Participant

    If it helps, what I’m aiming to do here is to create a data attribute and fill it with that ID number.

    #78486
    Barry
    Member

    Hi Erin: in terms of loading the first (upcoming) date of an event in a recurring series you could probably do this quite simply with tribe_get_start_date() and explicitly pass in the post ID for the event.

    In terms of grabbing the numeric portion of the post-xxxx class and using it to populate some other element/attribute I’m sure that’s possible whether server-side or by Javascript, but it’s the sort of customization we can’t unfortunately help too much with.

    #78491
    parkwaypartners
    Participant

    Thanks Barry –
    I was able to get the post ID thing figured out in javascript, and thanks to your suggestion I am able to get the start date for the recurring events, but not the end date – is there a reason why this would work: tribe_get_start_date( $post->ID, FALSE, ‘F j’ );
    but this just returns the start date again? tribe_get_end_date( $post->ID, FALSE, ‘F j’ );
    ?

    How else might I be able to get the last date for that recurring event?

    Thanks again for your help!

    #78515
    Barry
    Member

    is there a reason why this would work: tribe_get_start_date( $post->ID, FALSE, ‘F j’ );
    but this just returns the start date again? tribe_get_end_date( $post->ID, FALSE, ‘F j’ );

    So as things currently stand passing the post ID to those functions means you will get the start and end date of the first upcoming event in the series. For that reason, if each instance of the recurring event starts and ends on the same day, you will indeed get the same date back here.

    One way of getting what you need would be to insert a snippet like this one, admittedly a little rough and ready but you can always tweak it to meet your needs.

    #982648
    Support Droid
    Keymaster

    This topic has not been active for quite some time and will now be closed.

    If you still need assistance please simply open a new topic (linking to this one if necessary)
    and one of the team will be only too happy to help.

Viewing 6 posts - 1 through 6 (of 6 total)
  • The topic ‘Is there a way to get the post ID of the event?’ is closed to new replies.