Thematics Hooks

Of course, adding markup to your theme's head element is fairly uninteresting: most times you'll want to be playing with markup inside the site's body. Fortunately, Thematic provides a number of its own hooks, which we can use to add, remove, or adjust code at varying points throughout any page. Most of them are named according to where they are in the template, or what they do; here are the hooks you'll find most useful as a themer:

thematic_before thematic_aboveheader thematic_header—this builds the entire header div and also contains the following actions: thematic_brandingopen thematic_blogtitle thematic_blogdescription thematic_brandingclose thematic_access—this builds the menu, and a "skip to content" link thematic_belowheader thematic_abovecontent thematic_abovepost thematic_belowpost thematic_abovecomments thematic_belowcomments thematic_abovecommentslist thematic_belowcommentslist thematic_abovetrackbackslist thematic_belowtrackbackslist thematic_abovecommentsform thematic_belowcommentsform thematic_show_subscription_checkbox thematic_show_manual_subscription_form thematic_abovemainasides—asides are what Thematic calls its widget areas thematic_betweenmainasides thematic_belowmainasides thematic_abovefooter thematic_after

If you're the more visual type, check out this nifty wireframe11 by ThemeShaper Forums member dwenaus. It shows every widget area, major chunks of markup, and the most useful hooks as they appear in a template.

11 http://bluemandala.com/thematic/thematic-structure.html

Unless you have a much better memory than me, though, you'll probably never remember every hook and function available to you, so there's no sense in trying to learn them. Instead, you should focus on learning the process of finding what you want. Dig into the templates and Thematic's extension files, and consult the WordPress Codex when you run into functions that are part of WordPress's core functionality. To give you an idea of how that's done, let's tackle an example from top to bottom.

Was this article helpful?

0 0

Post a comment