Custom Upcoming Event Display

Home Forums Calendar Products Events Calendar PRO Custom Upcoming Event Display

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #13395
    Xpert
    Member

    I am using custom loop to generate the upcoming events. I would like to list the event as ‘Now’, ‘Soon’ and ‘Upcoming’ . Since I was in hurry and i am not good at programming 🙁 , I decided to assign category for events- like, ‘now’, ‘soon’ etc!. It works fine but that was not exactly i want.

    1) List the events that occurring on the current day as ‘NOW’.
    2) List the events from next 30 days except ‘Now’ as ‘Soon’.
    3) List all other events as ‘Upcoming’.

    This is the loop i am using.

    'upcoming', 'eventCat' => 15,'posts_per_page'=>50) );
    foreach($upcoming as $post) : setup_postdata($post);?>

    Thanks in advance.

    #13396
    Xpert
    Member


    global $post;
    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    $upcoming = tribe_get_events( array('eventDisplay'=>'upcoming', 'eventCat' => 15,'posts_per_page'=>50) );
    foreach($upcoming as $post) : setup_postdata($post)

    #13434
    Rob
    Member

    Hey Xpert. Thanks for sharing this. I’m not sure about this, but let me get our dev Jonah to take a look and see if he can offer up any suggestions.

    #13474
    Jonah
    Participant

    Hey Xpert,

    For #1 and #2, you can use the ‘start_date’ and ‘end_date’ arguments in the query to set your date range. You’ll need to figure out how to get today’s date and the next 30 days from todays date but that shouldn’t be too hard to Google.

    For #3 you can just use ‘eventDisplay’=>’upcoming’ and that will pull in only your upcoming events.

    Let us know if you need anything else.

    #13557
    Xpert
    Member

    Hi Jonah,

    Thank you for your tips. I am using below code to list the events after 7 days. But unfortunately didn’t work.
    Any solutions?.


    $CurrentDate = date('j M Y');
    $week = date('W');
    $Sevendays= date('j M Y', strtotime('7 days'));
    echo $Sevendays;
    $soon = tribe_get_events(array('eventDisplay'=>'upcoming','start_date'>$Sevendays,'posts_per_page'=>50) );
    foreach($soon as $post) : setup_postdata($post);?>

    Thank you.

    #13567
    Rob
    Member

    Hey Xpert. Jonah can take another look at this to see what’s wrong, but ultimately it’s going to be up to you to figure out the right code to use (as we just don’t have the support bandwidth to provide specific guidance on every custom request out there, unfortunately). Hopefully he can point you in the right direction with another quick look.

    #13572
    Jonah
    Participant

    Hi Xpert, you’re going to want to pass in an end date as well. In your example above you could set the end date like so:


    $EndDate = date('j M Y', strtotime('30 days'));

    So I think you would want to use ‘start_date’=>$CurrentDate and ‘end_date’=>$EndDate

    Also, I don’t think you need the eventDisplay arg in there. This works for me.

    – Jonah

    #975320
    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 8 posts - 1 through 8 (of 8 total)
  • The topic ‘Custom Upcoming Event Display’ is closed to new replies.