Change the default Event template on Blocks Editor

With the new Blocks Editor, all Post Types that have support for default templates for which order your block will show up when you create a new post. For events, we introduced a filter to allow you to easily customize your default content.

  • Hook name: tribe_events_editor_default_template
  • Parameters used on this Filter
    • $template - Array with Template blocks to be generated
    • $post_type - String with the Post type we are dealing with, defaults to tribe_events
    • $args - Array of arguments used to set up the Templates

 

We have a list of default blocks we use inside of The Events Calendar. In the following order:

  • tribe/event-datetime
  • core/paragraph
  • tribe/event-price
  • tribe/event-organizer
  • tribe/event-venue
  • tribe/event-website
  • tribe/event-links

Here a few examples of how you would use this to, for example, remove the organizer block as well as changing the whole template.

It's important to remember that the default value for each one of the blocks is an array that has the first key (0) as the block slug.