Common Worpdress Thesis Theme Problem Solved
Posted by Steve Mills | Posted in Web Development, Wordpress | Posted on 30-01-2009
2
I have been working on a customisation for the Wordpress Thesis theme by DiyThemes for a client of mine over the last few weeks.
Although Thesis offers a great deal of power in its backend, and is very well setup for SEO, it does behave very differently from your standard wordpress blog template. It uses hooks, which are chunks of code that with a single command you can insert before or after another element of code. Once you understand the power of hooks and what they can do, it makes performing drastic alteration to the look and feel of the site easy to do on a large scale level. That is, it’s easy to move sidebars, change fonts for headers and text etc,
This reliance on hooks however makes some of the simpler customisations, like changing the look of the menu, or making custom page templates a little bit harder. To do this, you need to edit the file called custom_functions.php, and add a function that is called by a hook at a certain time when the page loads.
For instance, the script below
function custom_archives_template() {
?>
<?php query_posts(’showposts=10′); // exclude the third category ?>
<?php if(have_posts()) : ?><?php while(have_posts()) : the_post(); ?>
<?php endwhile; ?>
<?php endif; ?>
<?php
} ?>
<?php
remove_action(’thesis_hook_archives_template’, ‘thesis_archives_template’);
add_action(’thesis_hook_archives_template’, ‘custom_archives_template’); ?>
The function contains all of the PHP, and it is then called by the hooks functions remove_action
(which gets rid of the old page elements) and add_action (which calls your new piece of code)
The problem that I was facing today is that I was leaving whitespace at the end of the custom_functions.php and getting a “Warning: Cannot modify header information - headers already sent by (output started at /home/web49060/public_html/wp-content/themes/thesis/custom/custom_functions.php:87) in /home/web49060/public_html/wp-includes/pluggable.php on line 850″Â error message.
A hard one to problem solve if you haven’t encountered it before.
The Thesis theme can be found at http://diythemes.com/thesis/





Hi Steven,
Yes that whitespace problem in the WordPress PHP files is a tough one to track down. I spent a lot of time figuring that one out too.
Learning Hooks in Thesis is the way to go though. I’ve worked with a lot of WordPress themes and right now Thesis is one of my favorites, because you can really extend it and isolate your changes in the /custom directory.
gr8 post dude..
thanx for sharing
andrew
smartappsportal.com