The new Thesis 2.0 also comes with a new set of hooks. The old hook system has been replaced with a combination of custom hooks within the HTML and new action hooks within the processing of the theme. You can now hook into various processes within Thesis and add your own functions. In this part of the seminar we look at some of these new hooks.
Again, inside of box.php in Thesis 2.0, there are lots of your standard hooks. You’ve got built in hooks like Thesis head scripts and Thesis hook body top, Thesis hook body bottom, Thesis hook before post and Thesis hook after post. And you’ve got Thesis hook after HTML and then you’ve also got things that you could add to a specific skin, some Thesis skin scripts.
But then you’ve got these custom hooks and you’ve probably noticed in those custom HTML boxes that they had a place for you to place a custom hook. Thesis has these custom hooks like Thesis hook before that hook name and Thesis hook hook name top and Thesis hook hook name bottom, Thesis hook after a hook name.
Post Related Custom Hooks
And then it also has those post related custom hooks; the kind that are based on post count. Thesis hook before hook name and then post 3 so if you want to put something in either an archive loop or a homepage loop on the 3rd post then you would use the post count style of hook.
Thesis had those all along but now, you can create your own custom hooks that are related to post counts and in essentially the same way. So you’ve got these more static custom hooks and then you’ve got the post count based custom hooks.
Hooks That No Longer Exist
The kinds of hooks that you’re probably most familiar with don’t exist much anymore. Thesis hook before content, Thesis hook after content and that kind of stuff because those were tied to the HTML and now the HTML is entirely different.
Finding New Hooks
Actually, I didn’t notice this before but there are a whole bunch of new hooks that give you a chance to interact with them and again, if you search for do action, you’re going to find instances of all those hooks. They’re primarily inside of box.php again but there are some inside of skin.php that you may want to interact with.
You might even want to hook into this Thesis include packages hook. Probably the majority though that you’re going to want to interact with really are in box.php.
But having said that, there’s quite a long list of possible hooks. The best way to really interact with those, I think, is to search for them and look at them because the ones that we used to be familiar with were bound to the HTML. And now, the majority of these are entirely outside of the HTML and they just exist in other contexts. And if you want ones assigned to the HTML then you create them , you create the HTML and then you create the function that hooks into that in your skin php.