The following theme hooks can be used to modify Thematic through your Child Theme functions.php file or even a custom plugin.
Theme Hooks
thematic_before()
Located in header.php just after the opening body tag, before anything else.
thematic_aboveheader()
Located in header.php just before the header div.
thematic_header()
This hook builds the content of the header div and loads the following actions:
| Action | Position Number |
|---|---|
| thematic_brandingopen() | 1 |
| thematic_blogtitle() | 3 |
| thematic_blogdescription() | 5 |
| thematic_brandingclose() | 7 |
| thematic_access() | 9 |
thematic_belowheader()
Located in header.php just after the header div.
thematic_abovecomments()
thematic_abovecommentslist()
thematic_belowcommentslist()
thematic_abovetrackbackslist()
thematic_belowtrackbackslist()
thematic_abovecommentsform()
thematic_show_subscription_checkbox()
thematic_belowcommentsform()
thematic_show_manual_subscription_form()
thematic_belowcomments()
thematic_abovemainasides()
thematic_betweenmainasides()
thematic_belowmainasides()
thematic_abovefooter()
thematic_after()
Examples
Plugins
The following will add Alex King’s Twitter Tools plugin to the header, beneath the access bar.
<pre><code>//lets give our new function a name
function my_tweets() {
//next lets define my_tweets
aktt_sidebar_tweets();
//lets end the definition now
}
//lets add our new action to the child theme to the header, beneath the access bar
add_action('thematic_header', 'my_tweets', 10);
Conditional Actions
The following would add a new stylesheet "pagediff.css" only if we are on a page with id=82.
//lets give our new action a name
function childtheme_css() {
//then define the action to take:
if (is_page('82')) {?>
<link rel="stylesheet" type="text/css" href="<?php echo
bloginfo('stylesheet_directory') ?>/homepage.css" /> <?php }
//end action:
}
//now we can add our new action to the appropriate place like so:
add_action('wp_head', 'childtheme_css');
The if (whatever-condition-is-true) {do_action .. won't work. The action would be added as soon as the condition is true .. and it stays added forever.
So if you need something conditional, you have to include it inside of your action. The action will be added and each time a new page is opened it'll check for the condition and the CSS will be loaded or not.
Removing Thematic Actions
Any Thematic action can be removed if desired. It's important to note that unlike add_action, remove_action cannot be called directly by functions.php -- instead, wrap the remove_action function in a wrapper function called by the 'init' action, like this:
// Remove default Thematic actions
function remove_thematic_actions() {
remove_action('thematic_hookname','thematic_actionname',optionalpostitionnumber);
}
add_action('init','remove_thematic_actions');