The This Week widget is a feature that comes bundled with The Events Calendar PRO 4.0. To activate it, you’ll need to make sure that The Events Calendar PRO 4.0 is first installed and active on your site.
From there, head over to Appearance > Widgets from the WordPress dashboard. You’re looking for a widget called This Week Events.
See the This Week Events widget? Drag it over to the sidebar widget area of your choice, then save your settings.
Now you can go to the front end of your website and see the This Week Events widget. The screenshots below show the horizontal view on the left and the vertical view on the right:
This Week Events Widget Settings
There are a few options that allow you to customize things a bit. These are the available options:
- Title: This is the heading that sits above the widget on the front end of the site. By default, it is blank, but it can be changed to anything you like.
- Layout: This option enables a vertical or horizontal layout of the events. Choose the one that works best for the widget area.
- Highlight Color: Choose a color to use to highlight today and all events. In the screenshots above, the high color is blue.
- Number of Events to Show: This allows you to set the maximum number of events that show per day. By default, this is set to five, but can be any number between one and ten.
- Add a filter: This option allows you to limit the events that display in the widget to certain categories and tags. Let’s say you only want events categorized as Conference to display in the widget. Perfect, add a filter! How about Conferences and Workshops? Add two filters!
Widget Display Notes
In the This Week Events widget you can expect the following:
- Recurring Events will show (without the tooltip)
- Events that are checked “Sticky in Month View” will show first
- Hide From Event Listings and Recurring event instances will not hide events in This Week Events widget, instead use tags and categories to show only the events you would like
Customizing the This Week Widget
You can also override the This Week Events widget templates to customize things even more. Our Themer’s Guide provides a comprehensive overview on theming and this article offers a great example of a specific customization to the widget.
First off, you can find the primary template for the widget at: /plugins/events-calendar-pro/src/views/pro/widgets/this-week-widget.php. To override the template:
- Make a copy of the file
- Make a new folder in your theme directory called tribe-events
- Make a new folder in that one called pro
- Make a new folder in that one called widgets
- Drop your copied file into that last folder
The rest of the templates for Events Calendar widget are located in either the mini-calendar or modules folder in the same directory as the primary template:
- this-week/nav.php – this is the nav for the This Week Events widget
- this-week/loop-grid-day.php – this is the structure for each day of the week
- this-week/single-event.php – this is responsible for displaying individual events in the day
Embedding the Widget
This Week Events widget can be embedded on any page or post outside of the sidebar. In other words, you can place it anywhere you want!
Embedding the widget can be as easy as pasting this shortcode into any page or post:
The shortcode has many different options for you to change the output and you can use this in any combination you like.
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.
You can also filter the widget within your shortcode, just as you might do with the widget itself:
[tribe_this_week category="black-tie-events" tag="members-only"]
It is also possible to specify multiple categories (or tags) by separating them out with commas:
Note too that you can use category (singular) and categories (plural) interchangeably – the same is true of tag and tags.
In the above examples, you are using the category/tag slugs, but you can also use numeric IDs so long as they are prefixed with the # symbol:
[tribe_this_week category="#40, #45, #150" tags="open, #269, free"]
As the final example shows, numeric IDs and category/tag slugs can freely be mixed together.
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 a 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.
Layout: Set the layout of the shortcode to horizontal or to vertical, default is horizontal for the shortcode.
Highlight Color: change the highlight color for the current day of the week and for each event border to the left of the event.
Count: This sets the per day count of events
That is everything for the This Week Events widget and the shortcode, if you have further questions do not hesitate to ask us!