Skip to main content

Using Theme Templates for Event and Location Pages

Events and locations are custom post types, so a classic theme displays a single event with its post template, often with a date line, author box or sidebar that doesn't suit an event. Events Manager lets you pick a different template from your theme for single event pages and for single location pages, with no code.

The list of named templates comes from classic themes, which have PHP page templates. With a block theme, the Pages choice uses the theme's Page template, and for anything finer you edit templates in the Site Editor.

Before you start

Check which templates your theme offers: edit any page and look at the Template menu. The same list appears in the Events Manager setting.

Choose a template​

  1. Go to Events then Settings then Pages then Event Pages.

  2. Set Display events as to one of:

    ChoiceResult
    PostsThe theme's single post template. This is how WordPress treats custom post types by default.
    PagesThe theme's default page template.
    A template under Theme TemplatesThat page template, for example a full-width one.
  3. Save the settings and view an event.

Locations have the same setting, Display locations as, in Events then Settings then Pages then Location Pages.

When the template doesn't look right​

A page template often relies on CSS classes that WordPress adds to the body tag or the article wrapper when a real page uses it, such as page-template-full-width. An event shown through the same template is still an event, so those classes are missing, and the layout can be slightly off: a gap where the sidebar was, or a narrower column.

Two fields under the template setting add the classes back:

FieldAdds classes to
Body ClassesThe body tag of single event pages
Post ClassesThe element printed by the theme's post_class() call, usually the article wrapper

To find out what to enter:

  1. Create a normal page, give it the same template, and view it.

  2. Open your browser's developer tools and look at the class attribute of the body tag. Note the classes that mention the template or the layout.

  3. Do the same on an event page and compare the two lists.

  4. Enter the classes the event page lacks in Body Classes, separated by spaces, and save. If the difference is on the article wrapper, use Post Classes.

Don't copy classes that describe the page itself, such as page-id-42.

Other ways to control the layout​

  • Override with Formats?, in the same settings section, controls whether the content of a single event page comes from the Single event page format or from the event's description as written.
  • A theme can include its own single-event.php and single-location.php files. WordPress uses these for the two post types ahead of any template chosen here, following its normal template hierarchy.
  • To change what is printed inside the content area, override Events Manager's template files or edit the formats.