Get cost of all events for month

Home Forums Calendar Products Events Calendar PRO Get cost of all events for month

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #1343355
    Jay
    Participant

    Hi, I’m trying to get the total cost from all events for a particular month. I’m able to get ALL of the entered costs for ALL published events with the following code:

    $arr = tribe_get_all_cost();
    foreach ($arr as $key => $value) {
    echo "Key: $key; Value: $value<br />\n";
    }

    But what I’d like to do is restrict this (for example) to the events published for September. Any help or suggestions would be appreciated. Thank you.

    #1343875
    Shelby
    Participant

    Hey there Jay!

    Great question, I’m happy to help. ๐Ÿ™‚

    Good work so far! ๐Ÿ™‚ You should be able to write pass an array utilizingย the function documented here in order to get the event date. That’s about as much guidance as I’m able to give you on this. You can check out and search the rest of our functions list here.

    Take care!

    Shelby ๐Ÿ™‚

    #1345015
    Jay
    Participant

    That was less helpful than not replying at all.

    #1345086
    Jay
    Participant
    $start_date = tribe_get_month_view_date();
    $format_end_date = strtotime( tribe_get_month_view_date() ) ;
    $end_date = date( 'Y-m-d', strtotime('+1 month', $format_end_date));
    $events = tribe_get_events( array(
        'eventDisplay' => 'custom',
        'start_date'   => $start_date,
        'end_date'     => $end_date
    ) );
    
    foreach ( $events as $event ) {
        echo tribe_get_cost($event->ID);
    }
    #1345718
    Barry
    Member

    Thanks for posting back with the solution, Jay – I’m sure others may find this useful ๐Ÿ™‚

    #1356220
    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 6 posts - 1 through 6 (of 6 total)
  • The topic ‘Get cost of all events for month’ is closed to new replies.