Home › Forums › Calendar Products › Events Calendar PRO › tribe_mini_calendar shortcode Show 5 upcoming events
- This topic has 5 replies, 2 voices, and was last updated 8 years, 11 months ago by Geoff.
-
AuthorPosts
-
April 26, 2015 at 8:48 pm #958406hypnotiqartParticipant
Is there a way to hide the shortcode calendar and just show 5 upcoming events?
April 27, 2015 at 11:00 am #958643GeoffMemberHello 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!
GeoffMay 4, 2015 at 11:33 am #960279GeoffMemberHi 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!
GeoffMay 4, 2015 at 8:49 pm #960416hypnotiqartParticipantThis reply is private.
May 5, 2015 at 7:36 am #960522GeoffMemberHey 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!
GeoffMay 19, 2015 at 9:20 am #963617GeoffMemberHey 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 -
AuthorPosts
- The topic ‘tribe_mini_calendar shortcode Show 5 upcoming events’ is closed to new replies.