Thesis provides built-in hook locations on rotator Boxes (e.g., HTML Containers, Post Boxes, and Query Boxes). To “activate” hooks for use on a particular Box, specify a Display ID on the Admin tab within the Skin Editor.
The syntaxes for hooks are as follows (where
$hook is the Display ID you’ve given to this Box):
Notice how the hook syntax follows a simple, predictable formula:
Also notice how Thesis automatically creates 4 hooks for core rotator elements: before, after, top, and bottom.
The before hook fires before the opening HTML tag for the Box in question, and the after hook fires after the closing HTML tag. The top hook fires immediately after the opening HTML tag, and the bottom hook fires immediately before the closing HTML tag.
In addition to the above hooks, these two are also available to you (note that you cannot specify your own unique hook name for them):
hook_before_html(just inside the opening
hook_after_html(just inside the closing
Where to Put Your Custom Hook Code
There are TWO places where you can add your custom hook-based PHP code:
Your Skin’s custom.php file; code you put in this file will only affect this particular Skin.
Your Thesis Master Control PHP file; code you put in this file will affect every Skin on your Thesis installation.
The Thesis hook naming syntax has evolved and become simpler over time. Here’s how the old and new syntaxes compare:
Here are the old and new syntaxes for an HTML Container (where
$hook is the name you’ve given to this Box’s hook):
And here are the old and new syntaxes for Post Boxes:
Important: Even though we retained the old hook syntax in 2.1 for compatibility reasons, we do plan to remove the old hooks in either 2.2 or 2.3 — so, you should migrate all of your hook-based PHP code to using the new syntax as soon as possible, and rely only on the new hook syntax for any future customizations as well.