The Wordpress Thesis Theme hooks

by Roberto on April 29, 2009

in Work

Thesis Theme for WordPress

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->innertext;
  if(substr($t, 0, 12) == 'thesis_hook_') {
    $m = 'my_thesis_'. substr($t, 12);
    echo "add_action('$t', '$m');\n";
    $n = $element->next_sibling();
    $desc = $n->innertext;
    if(substr($desc, 0, 7)=="&#8230;")
    {
      $desc = '';
    }
    else
    {
      $desc = "<p class=\"thesis_hook_description\">". $desc ."</p>";
    }
 
    echo "function $m() {\n";
    echo "echo '<div class=\"thesis_hook\">${t}${desc}</div>';\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.

<?php
//file : custom_function.php
add_action('thesis_hook_before_html', 'my_thesis_before_html');
function my_thesis_before_html() {
echo '<div class="thesis_hook">thesis_hook_before_html<p class="thesis_hook_description">Just after the opening <code>body</code> tag, before anything else.</p></div>';
}
 
add_action('thesis_hook_after_html', 'my_thesis_after_html');
function my_thesis_after_html() {
echo '<div class="thesis_hook">thesis_hook_after_html<p class="thesis_hook_description">Just before the closing <code>body</code> tag, after everything else.</p></div>';
}
 
add_action('thesis_hook_before_header', 'my_thesis_before_header');
function my_thesis_before_header() {
echo '<div class="thesis_hook">thesis_hook_before_header<p class="thesis_hook_description">Just before the block which usually contains the site name &#038; tagline.</p></div>';
}
 
add_action('thesis_hook_after_header', 'my_thesis_after_header');
function my_thesis_after_header() {
echo '<div class="thesis_hook">thesis_hook_after_header<p class="thesis_hook_description">Just after the block which usually contains the site name &#038; tagline.</p></div>';
}
 
add_action('thesis_hook_header', 'my_thesis_header');
function my_thesis_header() {
echo '<div class="thesis_hook">thesis_hook_header<p class="thesis_hook_description">Determines the content of <code>div#header</code>.</p></div>';
}
 
add_action('thesis_hook_before_title', 'my_thesis_before_title');
function my_thesis_before_title() {
echo '<div class="thesis_hook">thesis_hook_before_title<p class="thesis_hook_description">Within <code>div#header</code>, before the site title.</p></div>';
}
 
add_action('thesis_hook_after_title', 'my_thesis_after_title');
function my_thesis_after_title() {
echo '<div class="thesis_hook">thesis_hook_after_title<p class="thesis_hook_description">Within <code>div#header</code>, after the site tagline.</p></div>';
}
 
add_action('thesis_hook_before_content_box', 'my_thesis_before_content_box');
function my_thesis_before_content_box() {
echo '<div class="thesis_hook">thesis_hook_before_content_box<p class="thesis_hook_description">Within <code>div#page</code>, just before <code>div#content_box</code>. Depending on your settings, the feature box may be added to this hook.</p></div>';
}
 
add_action('thesis_hook_after_content_box', 'my_thesis_after_content_box');
function my_thesis_after_content_box() {
echo '<div class="thesis_hook">thesis_hook_after_content_box<p class="thesis_hook_description">Within <code>div#page</code>, just after <code>div#content_box</code>.</p></div>';
}
 
add_action('thesis_hook_before_content', 'my_thesis_before_content');
function my_thesis_before_content() {
echo '<div class="thesis_hook">thesis_hook_before_content<p class="thesis_hook_description">Within <code>div#content</code>, before posts begin.</p></div>';
}
 
add_action('thesis_hook_after_content', 'my_thesis_after_content');
function my_thesis_after_content() {
echo '<div class="thesis_hook">thesis_hook_after_content<p class="thesis_hook_description">Within <code>div#content</code>, after all posts.</p></div>';
}
 
add_action('thesis_hook_feature_box', 'my_thesis_feature_box');
function my_thesis_feature_box() {
echo '<div class="thesis_hook">thesis_hook_feature_box<p class="thesis_hook_description">Within <code>div#feature_box</code>; the feature box must be enabled in the Thesis Options for this hook to have any effect.</p></div>';
}
 
add_action('thesis_hook_before_post_box', 'my_thesis_before_post_box');
function my_thesis_before_post_box() {
echo '<div class="thesis_hook">thesis_hook_before_post_box</div>';
}
 
add_action('thesis_hook_after_post_box', 'my_thesis_after_post_box');
function my_thesis_after_post_box() {
echo '<div class="thesis_hook">thesis_hook_after_post_box</div>';
}
 
add_action('thesis_hook_before_teasers_box', 'my_thesis_before_teasers_box');
function my_thesis_before_teasers_box() {
echo '<div class="thesis_hook">thesis_hook_before_teasers_box</div>';
}
 
add_action('thesis_hook_after_teasers_box', 'my_thesis_after_teasers_box');
function my_thesis_after_teasers_box() {
echo '<div class="thesis_hook">thesis_hook_after_teasers_box</div>';
}
 
add_action('thesis_hook_before_post', 'my_thesis_before_post');
function my_thesis_before_post() {
echo '<div class="thesis_hook">thesis_hook_before_post<p class="thesis_hook_description">Within <code>div.format_text</code>, 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).</p></div>';
}
 
add_action('thesis_hook_after_post', 'my_thesis_after_post');
function my_thesis_after_post() {
echo '<div class="thesis_hook">thesis_hook_after_post<p class="thesis_hook_description">Within <code>div.format_text</code>, 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).</p></div>';
}
 
add_action('thesis_hook_before_teaser_box', 'my_thesis_before_teaser_box');
function my_thesis_before_teaser_box() {
echo '<div class="thesis_hook">thesis_hook_before_teaser_box</div>';
}
 
add_action('thesis_hook_after_teaser_box', 'my_thesis_after_teaser_box');
function my_thesis_after_teaser_box() {
echo '<div class="thesis_hook">thesis_hook_after_teaser_box</div>';
}
 
add_action('thesis_hook_before_teaser', 'my_thesis_before_teaser');
function my_thesis_before_teaser() {
echo '<div class="thesis_hook">thesis_hook_before_teaser</div>';
}
 
add_action('thesis_hook_after_teaser', 'my_thesis_after_teaser');
function my_thesis_after_teaser() {
echo '<div class="thesis_hook">thesis_hook_after_teaser</div>';
}
 
add_action('thesis_hook_before_headline', 'my_thesis_before_headline');
function my_thesis_before_headline() {
echo '<div class="thesis_hook">thesis_hook_before_headline<p class="thesis_hook_description">Within <code>div.headline_area</code>, 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).</p></div>';
}
 
add_action('thesis_hook_after_headline', 'my_thesis_after_headline');
function my_thesis_after_headline() {
echo '<div class="thesis_hook">thesis_hook_after_headline<p class="thesis_hook_description">Within <code>div>headline_area</code>, after the title of the page. If more than one post is shown on a page, this hook fires for each one.</p></div>';
}
 
add_action('thesis_hook_before_teaser_headline', 'my_thesis_before_teaser_headline');
function my_thesis_before_teaser_headline() {
echo '<div class="thesis_hook">thesis_hook_before_teaser_headline</div>';
}
 
add_action('thesis_hook_after_teaser_headline', 'my_thesis_after_teaser_headline');
function my_thesis_after_teaser_headline() {
echo '<div class="thesis_hook">thesis_hook_after_teaser_headline</div>';
}
 
add_action('thesis_hook_byline_item', 'my_thesis_byline_item');
function my_thesis_byline_item() {
echo '<div class="thesis_hook">thesis_hook_byline_item<p class="thesis_hook_description">Within <code>p.headline_meta</code>, 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.</p></div>';
}
 
add_action('thesis_hook_before_comment_meta', 'my_thesis_before_comment_meta');
function my_thesis_before_comment_meta() {
echo '<div class="thesis_hook">thesis_hook_before_comment_meta<p class="thesis_hook_description">Within <code>dt.comment</code>, before the comment&#8217;s meta information. If there is more than one comment on the page, this hook is fired for each one.</p></div>';
}
 
add_action('thesis_hook_after_comment_meta', 'my_thesis_after_comment_meta');
function my_thesis_after_comment_meta() {
echo '<div class="thesis_hook">thesis_hook_after_comment_meta<p class="thesis_hook_description">Within <code>dt.comment</code>, after the comment&#8217;s meta information. If there is more than one comment on the page, this hook is fired for each one.</p></div>';
}
 
add_action('thesis_hook_after_comment', 'my_thesis_after_comment');
function my_thesis_after_comment() {
echo '<div class="thesis_hook">thesis_hook_after_comment<p class="thesis_hook_description">Within <code>div.format_text</code>, after the comment&#8217;s text. If there is more than one comment on the page, this hook is fired for each one.</p></div>';
}
 
add_action('thesis_hook_comment_form', 'my_thesis_comment_form');
function my_thesis_comment_form() {
echo '<div class="thesis_hook">thesis_hook_comment_form<p class="thesis_hook_description">Within <code>form#commentform</code>, just before the paragraph containing the comment form&#8217;s submit button.</p></div>';
}
 
add_action('thesis_hook_archives_template', 'my_thesis_archives_template');
function my_thesis_archives_template() {
echo '<div class="thesis_hook">thesis_hook_archives_template</div>';
}
 
add_action('thesis_hook_custom_template', 'my_thesis_custom_template');
function my_thesis_custom_template() {
echo '<div class="thesis_hook">thesis_hook_custom_template</div>';
}
 
add_action('thesis_hook_faux_admin', 'my_thesis_faux_admin');
function my_thesis_faux_admin() {
echo '<div class="thesis_hook">thesis_hook_faux_admin<p class="thesis_hook_description">Within <code>div#content_box</code> (and also <code>div#column_wrap</code> 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.</p></div>';
}
 
add_action('thesis_hook_archive_info', 'my_thesis_archive_info');
function my_thesis_archive_info() {
echo '<div class="thesis_hook">thesis_hook_archive_info<p class="thesis_hook_description">Above the first post only on archive views (e.g., category listings, date listings, search results).</p></div>';
}
 
add_action('thesis_hook_404_title', 'my_thesis_404_title');
function my_thesis_404_title() {
echo '<div class="thesis_hook">thesis_hook_404_title<p class="thesis_hook_description">Within <code>h1</code>. Determines the title of 404 error pages (not the <code>title</code> which appears in the browser&#8217;s title bar).</p></div>';
}
 
add_action('thesis_hook_404_content', 'my_thesis_404_content');
function my_thesis_404_content() {
echo '<div class="thesis_hook">thesis_hook_404_content<p class="thesis_hook_description">Within <code>div.format_text</code>. Determines the content of a 404 error page.</p></div>';
}
 
add_action('thesis_hook_before_sidebars', 'my_thesis_before_sidebars');
function my_thesis_before_sidebars() {
echo '<div class="thesis_hook">thesis_hook_before_sidebars<p class="thesis_hook_description">Just within <code>div#sidebars</code>, before either sidebar or the multimedia box begins.</p></div>';
}
 
add_action('thesis_hook_after_sidebars', 'my_thesis_after_sidebars');
function my_thesis_after_sidebars() {
echo '<div class="thesis_hook">thesis_hook_after_sidebars<p class="thesis_hook_description">Within <code>div#sidebars</code>, after both sidebars.</p></div>';
}
 
add_action('thesis_hook_multimedia_box', 'my_thesis_multimedia_box');
function my_thesis_multimedia_box() {
echo '<div class="thesis_hook">thesis_hook_multimedia_box</div>';
}
 
add_action('thesis_hook_after_multimedia_box', 'my_thesis_after_multimedia_box');
function my_thesis_after_multimedia_box() {
echo '<div class="thesis_hook">thesis_hook_after_multimedia_box<p class="thesis_hook_description">Within <code>div#sidebars</code>, after the multimedia box.</p></div>';
}
 
add_action('thesis_hook_before_sidebar_1', 'my_thesis_before_sidebar_1');
function my_thesis_before_sidebar_1() {
echo '<div class="thesis_hook">thesis_hook_before_sidebar_1<p class="thesis_hook_description">Within <code>div#sidebar_1 ul.sidebar_list</code>, before sidebar 1&#8217;s first widget.</p></div>';
}
 
add_action('thesis_hook_after_sidebar_1', 'my_thesis_after_sidebar_1');
function my_thesis_after_sidebar_1() {
echo '<div class="thesis_hook">thesis_hook_after_sidebar_1<p class="thesis_hook_description">Within <code>div#sidebar_1 ul.sidebar_list</code>, after sidebar 1&#8217;s last widget.</p></div>';
}
 
add_action('thesis_hook_before_sidebar_2', 'my_thesis_before_sidebar_2');
function my_thesis_before_sidebar_2() {
echo '<div class="thesis_hook">thesis_hook_before_sidebar_2<p class="thesis_hook_description">Within <code>div#sidebar_2 ul.sidebar_list</code>, before sidebar 2&#8217;s first widget.</p></div>';
}
 
add_action('thesis_hook_after_sidebar_2', 'my_thesis_after_sidebar_2');
function my_thesis_after_sidebar_2() {
echo '<div class="thesis_hook">thesis_hook_after_sidebar_2<p class="thesis_hook_description">Within <code>div#sidebar_2 ul.sidebar_list</code>, after sidebar 2&#8217;s last widget.</p></div>';
}
 
add_action('thesis_hook_before_footer', 'my_thesis_before_footer');
function my_thesis_before_footer() {
echo '<div class="thesis_hook">thesis_hook_before_footer<p class="thesis_hook_description">Just before <code>div#footer</code>.</p></div>';
}
 
add_action('thesis_hook_after_footer', 'my_thesis_after_footer');
function my_thesis_after_footer() {
echo '<div class="thesis_hook">thesis_hook_after_footer<p class="thesis_hook_description">Just after <code>div#footer</code>.</p></div>';
}
 
add_action('thesis_hook_footer', 'my_thesis_footer');
function my_thesis_footer() {
echo '<div class="thesis_hook">thesis_hook_footer<p class="thesis_hook_description">Within <code>div#footer</code>.</p></div>';
}

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;
}

{ 9 trackbacks }

Posts about Theme as of April 28, 2009 · Fee Premium Themes Wordpress
April 28, 2009 at 18:01
Dagbok för 17 May 2009 | En sur karamell
May 17, 2009 at 22:05
Wordpress Thesis Theme – “Xấu giai” nhưng nổi tiếng | GIẢI PHÁP SỐ
June 26, 2009 at 19:38
techskull.com / The Wordpress Thesis Theme hooks
July 8, 2009 at 20:24
100+ Thesis Theme Resources | Cho Toan dot Com
August 6, 2009 at 04:59
Visual Slider, Unlimited Sidebars, Tabbed Widgets, and More! | 3asslema4Host
August 13, 2009 at 14:07
Wordpress Thesis Theme – “Xấu giai” nhưng nổi tiếng | TinhYeu.Mobi
September 27, 2009 at 03:30
250+ Thesis Theme Resources | Sahil Kotak dot Com
December 8, 2009 at 21:25
Hello world!
January 14, 2010 at 05:09

{ 14 comments… read them below or add one }

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.

Mike Salway April 29, 2009 at 05:58

Excellent! Just what i wanted. Thanks!

Dixie Vogel April 29, 2009 at 16:33

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

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.

Greg May 3, 2009 at 21:40

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

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!

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.

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!

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

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

Jeroen de Miranda August 22, 2009 at 17:58

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

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

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.

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

Leave a Comment

Previous post:

Next post: