tribe_mini_calendar shortcode Show 5 upcoming events

Home Forums Calendar Products Events Calendar PRO tribe_mini_calendar shortcode Show 5 upcoming events

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #958406
    hypnotiqart
    Participant

    Is there a way to hide the shortcode calendar and just show 5 upcoming events?

    #958643
    Geoff
    Member

    Hello Sorat, and welcome to the forums! I hope you’ve been enjoying the PRO plugins so far. 🙂

    Good question. The Mini Calendar is the only shortcode we have available at the moment.

    If you’re looking for a list of upcoming events instead, you could query those events in the page template itself using the tribe_get_events() function. Here’s a tutorial that would help get that off the ground.

    Any easier way might be to use the Event Rocket plugin. We don’t support that here in the forums, but it does add a number of additional shortcodes to the calendar that might do exactly what you’re looking for.

    Does this help answer your question? Please let mw know. 🙂

    Cheers!
    Geoff

    #960279
    Geoff
    Member

    Hi Sorat–just checking in to see if you still needed any assistance on this one or if you’re good to go. Please let me know. 🙂

    Cheers!
    Geoff

    #960416
    hypnotiqart
    Participant

    This reply is private.

    #960522
    Geoff
    Member

    Hey Sorat!

    Yeah, that’s the meat of the query that defines what type of events will display. You’ll want to tie it all together with a loop so the content for that query shows up as well. Something like this:

    // Ensure the global $post variable is in scope
    global $post;
    
    // Retrieve the next 5 upcoming events
    $events = tribe_get_events( array(
    ‘posts_per_page’ => 5,
    ‘start_date’ => new DateTime()
    ) );
    
    // Loop through the events: set up each one as
    // the current post then use template tags to
    // display the title and content
    foreach ( $events as $post ) {
    setup_postdata( $post );
    
    // This time, let's throw in an event-specific
    // template tag to show the date after the title!
    the_title();
    echo tribe_get_start_date();
    the_content();
    }

    That will go directly in the template of the page you want to add the events to. If you’d prefer to use a shortcode directly in WordPress instead, then I think the Event Rocket plugin would be an easier route for sure.

    Cheers!
    Geoff

    #963617
    Geoff
    Member

    Hey there, Sorat! This thread has been quiet for a while so I’m going to go ahead and close it. Please do feel free to start a new thread if you still have any questions here and we’d be happy to help. 🙂

    Cheers!
    Geoff

Viewing 6 posts - 1 through 6 (of 6 total)
  • The topic ‘tribe_mini_calendar shortcode Show 5 upcoming events’ is closed to new replies.