One customization request we’ve seen come up regularly is how to add post content to the Events Calendar widget. Here we’ll take a look at how to do just that.

The Scenario

Let’s say we have placed the Events Calendar widget in the sidebar of a page. We can expect to see a lot of information about our events, including the dates, times, location, and more, depending on our widget settings.

That’s nice and dandy, but what if we want to include a little more information about our events? Specifically, let’s find a way to add the event’s excerpt below the dates.

kb-widgets-add-excerpt

How it’s Done

The key here is that we can use the default WordPress function for the_excerpt() to display content from the event directly in the widget.

This will require a template override. If you’re new to overriding calendar templates, then it’s a good idea to check out our Themer’s Guide, which will walk you through the process step-by-step. The basic idea is that we will be creating a copy of one of the plugin’s templates, then adding it to our theme files. This allows us to override the template without touching the core code of the plugin.

  • Make a copy of the Mini Calendar’s list.php file. This is located in /plugins/events-calendar-pro/src/views/pro/widgets/mini-calendar/list.php.
  • Make a new folder in your theme directory. Call it tribe-events.
  • Make a new folder in that one. Call it pro.
  • Make a new folder in that one. Call it widgets.
  • Make one last new folder in that one. Call it mini-calendar.
  • Add the file. Drop the copied list.php file in that last folder.

Presto! Now that the template is in our theme directory, we can modify to suit our needs. In this case, we will add this:

<?php the_excerpt(); ?>

…right below the single event module. As of this writing, that is after Line 24 of the template.

KB widget excerpts

Now, we can save our work, head back to our widget and see the event’s excerpt display with the rest of the event’s information. Nice work!