• Resolved room34

    (@room34)


    Working on customizing a new site using the updated (“v2”) templates, I was shocked to discover there are no hooks in any of them! Is overriding entire template files our only way to customize things now?

    Since I’m usually making small, targeted changes, I prefer to use hooks vs. overriding entire template files and then having to keep them in sync as new updates are rolled out.

    Will these templates be getting hooks in the future?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Matthew Batchelder

    (@borkweb)

    Howdy!

    The updated templates implement a before/after hook that you can inject content around each template. Currently, in the Template implementation, each time we load a template we fire a set of filters and actions that can be summarized in this list:

    • before template inclusion:
      tribe_template_before_include:TEMPLATE/PATH
    • after template inclusion:
      tribe_template_after_include:TEMPLATE/PATH
    • before/after template HTML:
      tribe_template_html:TEMPLATE/PATH

    You can read about these hooks in our knowledgebase.

    In an upcoming release, we’ll be adding some additional hooks that will allow for the following (on all of the v2 templates):

    • before template inclusion:
      tribe_template_before_include:TEMPLATE/PATH
    • inside template container, before content:
      tribe_template_entry_point:TEMPLATE/PATH:after_container_open
    • inside template container, after content:
      tribe_template_entry_point:TEMPLATE/PATH:before_container_close
    • after template inclusion:
      tribe_template_after_include:TEMPLATE/PATH
    • before/after template HTML:
      tribe_template_html:TEMPLATE/PATH

    Hopefully the first set of hooks help out in the short term. The second set of hooks will hopefully be in our next release this month!

    Plugin Author Gustavo Bordoni

    (@bordoni)

    Just to add something to what my co-worker said above, in the link below you will find some really good examples of how to use some of those filters and hooks.

    https://theeventscalendar.com/knowledgebase/k/using-template-filters-and-actions/

    Hope that answers your question.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Where are all the hooks in the new (v2) templates in 5.x?’ is closed to new replies.