In WordPress, widgets can typically be placed in a sidebar or footer. Events Calendar Pro ships with a number of cool widgets, but sometimes you might want to use them on your site in locations other than a sidebar.
There are actually a couple of ways this can be achieved. One is to use a WordPress function called the_widget() in some custom coding in your theme or another plugin. Writing custom code like this is extremely flexible, but it also requires you to be comfortable writing in PHP—and it comes with the burden of maintaining that code through future upgrades.
A simpler alternative is to use a set of shortcodes provided by Events Calendar Pro that make it easy to embed the widgets within pages and posts; this is what we will look at in this article.
- Calendar Widget: [tribe_mini_calendar]
- Advanced List Widget: [tribe_events_list]
- Featured Venue Widget: [tribe_featured_venue]
- Countdown Widget: [tribe_event_countdown]
- This Week Widget: [tribe_this_week]
- Some shortcode arguments and functions are common to all of these shortcodes
Mini Calendar Shortcode
Using the shortcode is as easy as adding the following piece of text within a page or post:
Of course, the calendar widget also comes complete with an advanced set of filtering options and these can also be used with the shortcode. Here’s an example that looks for events in the party category:
We can supply a list of several category or tag slugs (we just need to separate them with commas) and we can also use IDs by prefixing them with the # symbol:
[tribe_mini_calendar categories="party, black-tie" tag="#512"]
Note how we used categories (plural), there. Singular and plural forms are interchangeable – and the same goes for tags. Last but not least, we can use the count attribute to control how many events are listed below the mini calendar:
Event List Shortcode
To embed the advanced list widget, simply use the following shortcode:
The same slug and ID based filtering capabilities offered by the mini calendar shortcode can also be used by this one. Here’s an example:
[tribe_events_list tags="#1024, #2048, featured" category="tickets-available"]
Choose which information is displayed
Also, just like the advanced list widget itself, it is possible to specify extra information which should be displayed, such as the phone number and address of each venue:
[tribe_events_list phone="yes" address="yes"]
Here’s a complete list of those optional details:
Finally, you can specify the maximum number of events that should be listed:
Featured Venue Shortcode
When you use the featured venue shortcode you must include at least one argument – the ID or slug of the venue that is being featured. Here’s an example using a slug:
It is also possible to use the venue’s post ID:
This shortcode optionally accepts one other argument – a limit for the number of events to list for the specified venue:
[tribe_featured_venue slug="the-whitehouse" limit="20"]
Will show the widget even if no upcoming events are scheduled for the venue:
[tribe_featured_venue slug="hollywood-bowl" hide_if_empty=false]
The countdown widget can be embedded with the following shortcode:
Just like the featured venue shortcode, an ID or slug must be specified or it will not work. This shortcode optionally allows for two further arguments, the first of which is show seconds:
[tribe_event_countdown slug="new-year-2016" show_seconds="yes"]
This causes the number of seconds to be displayed. The other argument is the text to show once the event begins and the countdown is complete:
[tribe_event_countdown slug="joes-party" complete="Yee hah!"]
This Week Widget
The This Week widget can be embedded with the shortcode [tribe_this_week].
You can customize the plugin in a number of ways. For example, you can decide how many events per day to display:
By default, the widget is laid out horizontally. If you want, you can do a vertical layout instead:
A full list of the available shortcode options for the This Week widget is available here.
Whichever shortcode you opt for, you can always make use of these additional arguments:
These are, hopefully, pretty self-explanatory and often will not be required when you use shortcodes-but they are there if you need them. We have plenty more shortcodes available in our article: Shortcodes
? Are you looking for shortcodes to embed full calendar views? As of version 4.3 of Events Calendar Pro, you can use a shortcode called [tribe_events] to insert full calendar views anywhere on your site. If this sounds useful, read more about this shortcode here.