The WordPress Thesis Theme hooks

2009-05-01 update Added the description of the hooks where available. Two series of visuals are now provided, with and without hook description. PHP code has been updated accordingly.

Thesis is a powerful theme for WordPress. It has many valuable features that help you to be productive in minutes with your WordPress website :

  1. SEO compliance
  2. accessibility
  3. usability
  4. flexibility

It has also an extensive manual, a large community and support forums.
You can control almost all its features from the integrated administration settings page. It provides also many hooks that help you to customize the theme.
To help to visualize the position on the pages where these hooks are called, I have prepared the following screenshots. Below I describe also the procedure I followed to generate dynamically the PHP code to insert the hooks calls and show their positions on the page.

Suggested books

WordPress Plugin Development: Beginner's GuideWordPress Theme Design

WordPress Thesis Theme Visuals
Page Visuals without descriptions Visuals with descriptions
Hooks on the home page Thesis hooks home page Thesis hooks (with description) home page
Hooks on a generic page Thesis hooks generic page Thesis hooks (with description) generic page
Hooks on a post page Thesis hooks post Thesis hooks (with description) post

To insert the html code that highlights the hooks, I added the hooks to the custom_function.php file, under the directory wp-content/themes/thesis/custom, but I generated dynamically this code, parsing the Thesis user guide page, so when the hooks will change I can recreate the necessary code in seconds. I used the PHP Simple HTML DOM parser library and created this script (create_thesis_hooks.php) that produces the PHP code to add to the custom_function.php file :

<!--?php 
//file : create_thesis_hooks.php
include_once("simple_html_dom.php");
$url = "http://diythemes.com/thesis/rtfm/hooks/";
 
$html = file_get_html($url);
 
foreach($html--->find('dl dt') as $element) {
  $t = $element-&gt;innertext;
  if(substr($t, 0, 12) == 'thesis_hook_') {
    $m = 'my_thesis_'. substr($t, 12);
    echo "add_action('$t', '$m');\n";
    $n = $element-&gt;next_sibling();
    $desc = $n-&gt;innertext;
    if(substr($desc, 0, 7)=="…")
    {
      $desc = '';
    }
    else
    {
      $desc = "

“. $desc .”

";
    }
 
    echo "function $m() {\n";
    echo "echo '
${t}${desc}
';\n";
    echo "}\n\n";
  }
}

You can run script and write the output into a temporary file : php create_thesis_hooks.php > hooks_tmp.php.
The last step is to copy and paste the content of hooks_tmp.php into your custom_function.php file.
For convenience here there is the code to insert in this file.

thesis_hook_before_html

Just after the opening body tag, before anything else.

';
}
 
add_action('thesis_hook_after_html', 'my_thesis_after_html');
function my_thesis_after_html() {
echo '
thesis_hook_after_html

Just before the closing body tag, after everything else.

';
}
 
add_action('thesis_hook_before_header', 'my_thesis_before_header');
function my_thesis_before_header() {
echo '
thesis_hook_before_header

Just before the block which usually contains the site name & tagline.

';
}
 
add_action('thesis_hook_after_header', 'my_thesis_after_header');
function my_thesis_after_header() {
echo '
thesis_hook_after_header

Just after the block which usually contains the site name & tagline.

';
}
 
add_action('thesis_hook_header', 'my_thesis_header');
function my_thesis_header() {
echo '
thesis_hook_header

Determines the content of div#header.

';
}
 
add_action('thesis_hook_before_title', 'my_thesis_before_title');
function my_thesis_before_title() {
echo '
thesis_hook_before_title

Within div#header, before the site title.

';
}
 
add_action('thesis_hook_after_title', 'my_thesis_after_title');
function my_thesis_after_title() {
echo '
thesis_hook_after_title

Within div#header, after the site tagline.

';
}
 
add_action('thesis_hook_before_content_box', 'my_thesis_before_content_box');
function my_thesis_before_content_box() {
echo '
thesis_hook_before_content_box

Within div#page, just before div#content_box. Depending on your settings, the feature box may be added to this hook.

';
}
 
add_action('thesis_hook_after_content_box', 'my_thesis_after_content_box');
function my_thesis_after_content_box() {
echo '
thesis_hook_after_content_box

Within div#page, just after div#content_box.

';
}
 
add_action('thesis_hook_before_content', 'my_thesis_before_content');
function my_thesis_before_content() {
echo '
thesis_hook_before_content

Within div#content, before posts begin.

';
}
 
add_action('thesis_hook_after_content', 'my_thesis_after_content');
function my_thesis_after_content() {
echo '
thesis_hook_after_content

Within div#content, after all posts.

';
}
 
add_action('thesis_hook_feature_box', 'my_thesis_feature_box');
function my_thesis_feature_box() {
echo '
thesis_hook_feature_box

Within div#feature_box; the feature box must be enabled in the Thesis Options for this hook to have any effect.

';
}
 
add_action('thesis_hook_before_post_box', 'my_thesis_before_post_box');
function my_thesis_before_post_box() {
echo '
thesis_hook_before_post_box
';
}
 
add_action('thesis_hook_after_post_box', 'my_thesis_after_post_box');
function my_thesis_after_post_box() {
echo '
thesis_hook_after_post_box
';
}
 
add_action('thesis_hook_before_teasers_box', 'my_thesis_before_teasers_box');
function my_thesis_before_teasers_box() {
echo '
thesis_hook_before_teasers_box
';
}
 
add_action('thesis_hook_after_teasers_box', 'my_thesis_after_teasers_box');
function my_thesis_after_teasers_box() {
echo '
thesis_hook_after_teasers_box
';
}
 
add_action('thesis_hook_before_post', 'my_thesis_before_post');
function my_thesis_before_post() {
echo '
thesis_hook_before_post

Within div.format_text, before post content. If more than one post is shown on a page, this hook fires before each of them. The position of the post is passed as a parameter if needed in actions added to this hook (targeting only the first or third posts, for example).

';
}
 
add_action('thesis_hook_after_post', 'my_thesis_after_post');
function my_thesis_after_post() {
echo '
thesis_hook_after_post

Within div.format_text, after post content. If more than one post is shown on a page, this hook fires before each of them. The position of the post is passed as a parameter if needed in actions added to this hook (targeting only the first or third posts, for example).

';
}
 
add_action('thesis_hook_before_teaser_box', 'my_thesis_before_teaser_box');
function my_thesis_before_teaser_box() {
echo '
thesis_hook_before_teaser_box
';
}
 
add_action('thesis_hook_after_teaser_box', 'my_thesis_after_teaser_box');
function my_thesis_after_teaser_box() {
echo '
thesis_hook_after_teaser_box
';
}
 
add_action('thesis_hook_before_teaser', 'my_thesis_before_teaser');
function my_thesis_before_teaser() {
echo '
thesis_hook_before_teaser
';
}
 
add_action('thesis_hook_after_teaser', 'my_thesis_after_teaser');
function my_thesis_after_teaser() {
echo '
thesis_hook_after_teaser
';
}
 
add_action('thesis_hook_before_headline', 'my_thesis_before_headline');
function my_thesis_before_headline() {
echo '
thesis_hook_before_headline

Within div.headline_area, before the title of the page. If more than one post is shown on a page, this hook fires for each one. The position of the post is passed as a parameter if needed in actions added to this hook (targeting only the first or third posts, for example).

';
}
 
add_action('thesis_hook_after_headline', 'my_thesis_after_headline');
function my_thesis_after_headline() {
echo '
thesis_hook_after_headline

Within div>headline_area, after the title of the page. If more than one post is shown on a page, this hook fires for each one.

';
}
 
add_action('thesis_hook_before_teaser_headline', 'my_thesis_before_teaser_headline');
function my_thesis_before_teaser_headline() {
echo '
thesis_hook_before_teaser_headline
';
}
 
add_action('thesis_hook_after_teaser_headline', 'my_thesis_after_teaser_headline');
function my_thesis_after_teaser_headline() {
echo '
thesis_hook_after_teaser_headline
';
}
 
add_action('thesis_hook_byline_item', 'my_thesis_byline_item');
function my_thesis_byline_item() {
echo '
thesis_hook_byline_item

Within p.headline_meta, just before the edit link (if enabled). This hook will only have a noticeable affect if there is a byline to display according to the settings in Thesis Options. If more than one post is shown on a page, this hook is fired for each one.

';
}
 
add_action('thesis_hook_before_comment_meta', 'my_thesis_before_comment_meta');
function my_thesis_before_comment_meta() {
echo '
thesis_hook_before_comment_meta

Within dt.comment, before the comment’s meta information. If there is more than one comment on the page, this hook is fired for each one.

';
}
 
add_action('thesis_hook_after_comment_meta', 'my_thesis_after_comment_meta');
function my_thesis_after_comment_meta() {
echo '
thesis_hook_after_comment_meta

Within dt.comment, after the comment’s meta information. If there is more than one comment on the page, this hook is fired for each one.

';
}
 
add_action('thesis_hook_after_comment', 'my_thesis_after_comment');
function my_thesis_after_comment() {
echo '
thesis_hook_after_comment

Within div.format_text, after the comment’s text. If there is more than one comment on the page, this hook is fired for each one.

';
}
 
add_action('thesis_hook_comment_form', 'my_thesis_comment_form');
function my_thesis_comment_form() {
echo '
thesis_hook_comment_form

Within form#commentform, just before the paragraph containing the comment form’s submit button.

';
}
 
add_action('thesis_hook_archives_template', 'my_thesis_archives_template');
function my_thesis_archives_template() {
echo '
thesis_hook_archives_template
';
}
 
add_action('thesis_hook_custom_template', 'my_thesis_custom_template');
function my_thesis_custom_template() {
echo '
thesis_hook_custom_template
';
}
 
add_action('thesis_hook_faux_admin', 'my_thesis_faux_admin');
function my_thesis_faux_admin() {
echo '
thesis_hook_faux_admin

Within div#content_box (and also div#column_wrap if a sidebars-first three-column layout is in use). Can be used with plugins such as Customize Your Community to customize things like the login form.

';
}
 
add_action('thesis_hook_archive_info', 'my_thesis_archive_info');
function my_thesis_archive_info() {
echo '
thesis_hook_archive_info

Above the first post only on archive views (e.g., category listings, date listings, search results).

';
}
 
add_action('thesis_hook_404_title', 'my_thesis_404_title');
function my_thesis_404_title() {
echo '
thesis_hook_404_title

Within h1. Determines the title of 404 error pages (not the title which appears in the browser’s title bar).

';
}
 
add_action('thesis_hook_404_content', 'my_thesis_404_content');
function my_thesis_404_content() {
echo '
thesis_hook_404_content

Within div.format_text. Determines the content of a 404 error page.

';
}
 
add_action('thesis_hook_before_sidebars', 'my_thesis_before_sidebars');
function my_thesis_before_sidebars() {
echo '
thesis_hook_before_sidebars

Just within div#sidebars, before either sidebar or the multimedia box begins.

';
}
 
add_action('thesis_hook_after_sidebars', 'my_thesis_after_sidebars');
function my_thesis_after_sidebars() {
echo '
thesis_hook_after_sidebars

Within div#sidebars, after both sidebars.

';
}
 
add_action('thesis_hook_multimedia_box', 'my_thesis_multimedia_box');
function my_thesis_multimedia_box() {
echo '
thesis_hook_multimedia_box
';
}
 
add_action('thesis_hook_after_multimedia_box', 'my_thesis_after_multimedia_box');
function my_thesis_after_multimedia_box() {
echo '
thesis_hook_after_multimedia_box

Within div#sidebars, after the multimedia box.

';
}
 
add_action('thesis_hook_before_sidebar_1', 'my_thesis_before_sidebar_1');
function my_thesis_before_sidebar_1() {
echo '
thesis_hook_before_sidebar_1

Within div#sidebar_1 ul.sidebar_list, before sidebar 1’s first widget.

';
}
 
add_action('thesis_hook_after_sidebar_1', 'my_thesis_after_sidebar_1');
function my_thesis_after_sidebar_1() {
echo '
thesis_hook_after_sidebar_1

Within div#sidebar_1 ul.sidebar_list, after sidebar 1’s last widget.

';
}
 
add_action('thesis_hook_before_sidebar_2', 'my_thesis_before_sidebar_2');
function my_thesis_before_sidebar_2() {
echo '
thesis_hook_before_sidebar_2

Within div#sidebar_2 ul.sidebar_list, before sidebar 2’s first widget.

';
}
 
add_action('thesis_hook_after_sidebar_2', 'my_thesis_after_sidebar_2');
function my_thesis_after_sidebar_2() {
echo '
thesis_hook_after_sidebar_2

Within div#sidebar_2 ul.sidebar_list, after sidebar 2’s last widget.

';
}
 
add_action('thesis_hook_before_footer', 'my_thesis_before_footer');
function my_thesis_before_footer() {
echo '
thesis_hook_before_footer

Just before div#footer.

';
}
 
add_action('thesis_hook_after_footer', 'my_thesis_after_footer');
function my_thesis_after_footer() {
echo '
thesis_hook_after_footer

Just after div#footer.

';
}
 
add_action('thesis_hook_footer', 'my_thesis_footer');
function my_thesis_footer() {
echo '
thesis_hook_footer

Within div#footer.

';
}

And some css code in the custom.css file can help to identify the hooks position on the page :

div.thesis_hook {
border: 1px solid red;
font-size: 11pt;
color: red;
font-weight: bold;
}
 
p.thesis_hook_description {
font-size: 10pt !important;
color: #000000;
font-weight: bold;
font-style: italic;
}

,

40 Responses to The WordPress Thesis Theme hooks

  1. The Mules April 28, 2009 at 23:58 #

    Holy horses! Great work, Roberto – you’ve crossed our next post straight off the chores list, one we were not looking forward to very much – thanks!

    Very sharp and clear resource; we’ll be referencing this one frequently.

  2. Mike Salway April 29, 2009 at 05:58 #

    Excellent! Just what i wanted. Thanks!

  3. Dixie Vogel April 29, 2009 at 16:33 #

    THANK you so much! This is a much needed and easy-to-follow resource. :)

  4. Sire May 3, 2009 at 08:07 #

    While I run Thesis on one of my blogs this stuff is way over my head. As far as flexibility and ease of use goes I much prefer the them I use on my other blogs. I’m not saying Thesis isn’t better than your run of the mill themes, just that it isn’t as easy to use as I originally thought.

  5. Greg May 3, 2009 at 21:40 #

    This looks very familar to http://thesishooks.com
    Way to rip me off chum.

  6. Mike Nichols May 4, 2009 at 11:17 #

    Thank you so much for this post! I really needed a good visual prompt for the Thesis hooks, and this is just the right thing. I know this took a lot of work, and I really appreciated it!

  7. Roberto May 5, 2009 at 08:50 #

    Hi Greg.
    Please, feel free to download the visuals from my post and upload on your website. I made them only to share my knowledge with others.

  8. Somone May 7, 2009 at 08:14 #

    Very generous offer you have made to Greg. He’d have rocks in his head not to take you up on your offer considering his site is all about hooks. This is amazing work – something we all can use but dreadful to put together. I thank God (and whoever else is listening) everyday that KingdomGeek blessed us with Thesis OpenHook. As a self-taught coder/hacker, I always have trouble trying to get my php functions to work properly.

    Can you please translate (English is fine) what you said after “Good morning Chief”?! I mean, do you mean that the code you made can run and spit out the images you made? Cheers!

  9. Greg May 8, 2009 at 18:52 #

    Sorry. I was quite rude and you didn’t deserve it. I will take you up on your offer and give you full credit.

    Good work sir

  10. Pieter May 29, 2009 at 16:04 #

    Thank you very much for making this clear. However, I have a question: I am using Thesis OpenHook – how do I change something on my About page, without effecting any of the other pages. From your description, I need to use “thesis_hook_before_post” for instance, but when I use that it changes all my pages. How do I make changes to only one specific page? Thanks.
    Pieter

  11. Jeroen de Miranda August 22, 2009 at 17:58 #

    Just what I was looking for; great job, thanks! Jeroen

  12. scott fidge November 18, 2009 at 17:11 #

    Nice one Roberto!
    I just came across this post while searching for something completely different! I wish i had this when i first started out with Thesis!! I will use this going forward though as it’s really nice to see things laid out visually. Thanks again for putting the time into this. ^o^
    -scott

  13. Bill Bolmeier November 19, 2009 at 18:53 #

    This is great Roberto. I was looking for a detail visual of the all the Thesis hooks. This answered a question I had right away. Excellent.

  14. Atlanta Townhome December 24, 2009 at 06:02 #

    These visual guides are awesome and solve a lot of issues in seconds. Really appreciate this information being shared.

    -RM

  15. Thesis Theme Design March 15, 2010 at 22:54 #

    Actually hooks is the thing the made the Thesis more customizable than ever and it can totally change the default outlook of a theme.

    Thanks 4 the info you provided.

  16. Mario Borg March 31, 2010 at 01:04 #

    Hi,

    thanks this is great info, i have a question, note sure if its related to openhooks, how do you put the byliners to show up before the headline?

    Regards
    Mario

  17. Roberto March 31, 2010 at 09:36 #

    Hi Mario. Not sure to understand what you mean.
    I can share my full code with you if you need it.

  18. Baloot April 8, 2010 at 18:05 #

    I just make all this screenshot to be my wallpaper when designing Thesis theme. Thank you Roberto. :)

  19. NLP Training June 11, 2010 at 01:35 #

    I like how you presented this blog post. All elements are there. Detailed tutorials with visual effects that we can easily follow. Thanks for sharing it.

  20. predictive dialers June 17, 2010 at 10:32 #

    Thanks for sharing this tutorial. It’s much more easy to follow cause we can actually see the print screen of every phase.

  21. Tom June 19, 2010 at 11:33 #

    is there a way in thesis to remove the sidebar on category pages without using css! I really wanted to use a hook but there are no hooks i can find to use to edit the inside of the content_box and sidebars etc for a category page.. this is vital for galleries etc?!

  22. Justin July 3, 2010 at 03:23 #

    This is an epic share man! Thank you!!

  23. Stijn October 15, 2010 at 00:08 #

    Do you happen to know if there are any hooks for the archives pages (categories and especially tags) as well? I’m trying to make those pages more interesting on my site, but cannot target the areas I want. No news on the forums, nor at RTFM.

  24. rob | relocate to atlanta October 31, 2010 at 04:38 #

    This is an awesome article. I know it’s “old” but I just used it to add some content above my two sidebars and it took like 10 minutes!

    Great, thanks!

  25. Web development Sydney December 2, 2010 at 02:51 #

    Its nice that you actually add the codes here. A sort of tutorial on my part since I really don’t know how to make PHP code to have a better looking theme. I am hoping to learn soon.

  26. water distiller April 7, 2011 at 08:24 #

    Thank you! You are a savior! I am now doing my thesis and you are just in time. I am going to use some of this…

  27. VnTim April 15, 2011 at 09:16 #

    Profactional

  28. shashank chinchli June 28, 2011 at 02:22 #

    Ultimate tutorial dude!
    thanks a lot for sharing them over here.

Trackbacks/Pingbacks

  1. Posts about Theme as of April 28, 2009 · Fee Premium Themes Wordpress - April 28, 2009

    [...] class=keywordThemes/strong are usually free (except the premium ones) and allow you to freely The WordPress Thesis Theme hooks – speedtech.it 04/28/2009 by Roberto on April 28, 2009 Thesis is a powerful theme for strong [...]

  2. Dagbok för 17 May 2009 | En sur karamell - May 17, 2009

    [...] The WordPress Thesis Theme hooks — 20:19 via [...]

  3. Wordpress Thesis Theme – “Xấu giai” nhưng nổi tiếng | GIẢI PHÁP SỐ - June 26, 2009

    [...] http://speedtech.it/2009/04/the-wordpress-thesis-theme-hooks/ [...]

  4. techskull.com / The Wordpress Thesis Theme hooks - July 8, 2009

    [...] The WordPress Thesis Theme hooks. Post a comment — Trackback URI RSS 2.0 feed for these comments This entry (permalink) was posted on Wednesday, July 8, 2009, at 5:03 pm by . Filed in thesis. [...]

  5. 100+ Thesis Theme Resources | Cho Toan dot Com - August 6, 2009

    [...] The WordPress Thesis Theme hooks – Speed Tech [...]

  6. Visual Slider, Unlimited Sidebars, Tabbed Widgets, and More! | 3asslema4Host - August 13, 2009

    [...] provides a reference itemize of acquirable hooks; and for seeable reference, both Thesis Hooks and The WordPress Thesis Theme hooks are worth a [...]

  7. Wordpress Thesis Theme – “Xấu giai” nhưng nổi tiếng | TinhYeu.Mobi - September 27, 2009

    [...] http://speedtech.it/2009/04/the-wordpress-thesis-theme-hooks/ [...]

  8. 250+ Thesis Theme Resources | Sahil Kotak dot Com - December 8, 2009

    [...] The WordPress Thesis Theme hooks [...]

  9. Hello world! - January 14, 2010

    [...] and provides a reference list of available hooks; and for visual reference, both Thesis Hooks and The WordPress Thesis Theme hooks are worth a [...]

  10. The WordPress Thesis Theme hooks - August 13, 2010

    [...] Source  http://speedtech.it/2009/04/the-wordpress-thesis-theme-hooks/ [...]

  11. Visual Slider, Unlimited Sidebars, Tabbed Widgets, and More! - August 31, 2010

    [...] and provides a reference list of available hooks; and for visual reference, both Thesis Hooks and The WordPress Thesis Theme hooks are worth a [...]

  12. Easy Thesis Hooks Guide with illustration - September 5, 2010

    [...] understanding it’s very difficult to understand which hook refers to which position. Fortunately, http://speedtech.it/2009/04/the-wordpress-thesis-theme-hooks/ came out with the idea of explaining thesis hooks with [...]