Kirby Core Hooks

Is there such a thing as an action hook for Kirby Core? I am writing a plugin that needs some default css and js and would like to load these automatically. I’m looking for some thing like the panel hooks but for views on the front end.

1 Like

I’m guessing you must be coming at this from a Wordpress perspective as I do.

As far as I know, there’s no functional equivalent to Wordpress’s wp_head() that people are dropping into their template headers, so there wouldn’t really be any function to hook into.

Yeah, just edit your footer or header snippets.

Cool thanks.

Been a while since I’ve worked with WP, but that’s what I was thinking.

I agree with @ScottKbka. Following hooks that i’m expecting on core, is it possible @bastianallgeier?

kirby()->hook('user.login', function($user) {
  // your hook code
});

kirby()->hook('user.logout', function($user) {
  // your hook code
});

kirby()->hook('site.init', function($site) {
  // your hook code
});

kirby()->hook('page.loaded', function($page) {
  // your hook code
});