Events Calendar Pro Widget Shortcodes
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 makes it easy to embed the widgets within pages and posts; this is what we will look at in this article.
- Event Calendar Widget: [tribe_mini_calendar]
- Event List Widget: [tribe_events_list]
- Featured Venue Widget: [tribe_featured_venue]
- Event Countdown Widget: [tribe_event_countdown]
- Events By Week Widget: [tribe_this_week]
- Some shortcode arguments and functions are common to all of these shortcodes
Event 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 categories 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:
You can also add a tax-operand attribute to the calendar so that multiple categories or tags can display at once:
[tribe_mini_calendar tags="cabbage, broccoli" tax-operand="AND"]
Note: You can also embed the regular calendar Month View with the shortcode [tribe_events view=“month”]
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" tax-operand="OR" 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]
Event Countdown Shortcode
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!"]
Events By Week Widget
The Events By 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:
Start Date: This is used to set the week of events to show. This will find the start of the week based on your WordPress setting and use that for the first day of the week. For example if your setting is to start the week on Monday and you put the date of Wednesday the 6th it will start with Monday the 4th.
Use the date format in your settings here: Events > Settings > Display Tab > “Date with year”
Week Offset: Use this to show a week in the future. For example if you want to always show next weeks events add a 1 and it will show the This Week Widget starting with the next start of the week.
Note the offset only accepts positive numbers.
Hide Weekends: set this to 1 and it will hide Saturdays and Sundays.
Operand: You use this option to change between to using “and” or to use “or” for the filters. The default is “or” so if you have two event categories it will find all events with either of those. If you change to “and” it will return events that have both of those event categories.
Note: You can also embed the regular calendar Week View into a page wit the shortcode [tribe_events view=“week”].
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.