Thesis Custom Template

This is a demo page that makes use of the Custom Template feature of the Thesis theme.

Things to note:

  • All of the text on this page has been added via the Edit Page screen in WordPress, the same as any other page. It’s up to the template to pull this in.
  • The sidebar has not been invoked, so it doesn’t appear – great for landing / squeeze pages to minimise distractions.
  • The custom footer widgets, that appear on all other content and archive posts and pages on this site, has been removed.
  • By applying a custom CSS Class via one of the Thesis Theme options on the Edit Page screen, some simple styling has also been applied so that the footer border and content_box background have been removed, and the content can spread all the way across the full available width of the content_box.

I created the page as normal, set the Template to “Custom Template”, published the page, then added the following into custom_function.php:

function custom_template_page() {
  if ( is_page('1436') ) {
  ?>
  <div id="content">
    <div class="post_box top">
    <?php if (have_posts()) : ?>
      <?php while (have_posts()) : the_post(); ?>
      <div class="headline_area">
	      <h1><?php the_title(); ?></h1>
      </div>
      <div class="format_text">
        <?php the_content(); ?>
      </div>
      <?php endwhile; ?>
    <?php endif; ?>
    </div>
  </div>
  <?php
  remove_action('thesis_hook_footer', 'customFooter');
  }
}
remove_action('thesis_hook_custom_template','thesis_custom_template_sample');
add_action('thesis_hook_custom_template', 'custom_template_page');

The remove_action('thesis_hook_footer', 'customFooter'); simply undoes an add_action that I have as a default for all posts / pages, which adds in a customFooter function.

The 1436 refers to the internal pageID of this page.

For the CSS, I simply used:

/* Custom-template-page */
.custom_template_page #content {width: 100%;}
.custom_template_page #content_box {background: #FFF;}
.custom_template_page #footer {border-top: none;}

…where .custom_template_page is the name of the Custom Body Class added via one of the Thesis boxes on the Edit Page screen.