DM-Bloodless WordPress Theme Fixed

Take note: DM-Bloodless support has been discontinued by the author long ago. For similar WordPress themes try Themeforest [partner-link]. Check out PIM, Deadline or TutsPlaza [partner-links] instead.

I fixed DM-Bloodless! Well, kudos to Deaf Musician for this lovely black and white WordPress theme. As it’s his first one he overlooked something. It caused an ugly error that was difficult to locate without prior knowledge of WordPress or PHP.

The dreaded “Warning: Cannot modify header information – headers already sent” error was produced by the functions.php

As stated in the WordPress Forum here every page of the internal WordPress code has to start with a “<?php” without prior spaces or blank lines. Also, no white space is allowed after the closing tag “?>”.

Moreover you have to use one PHP block for all PHP code, unlike now where every function has it’s own block with, of course, white space in it.

You can substitute your old one in the dmbloodless folder. Coded correctly, it looks like that:

<?php

/*

Template Name: Functions

*/

include(dirname(__FILE__).’/themetoolkit.php’);

themetoolkit(

‘dmbloodless’,

array(

‘about’ => ‘About This Blog {textarea|3|50} ## Keep it so it fits on one line.’,

‘style’ => ‘Theme Color Option {radio|bw|Black On White|wb|White On Black}’,

),

__FILE__

);

function dmbloodless_about() {

global $dmbloodless;

print $dmbloodless->option['about'];

}

function dmbloodless_style() {

global $dmbloodless;

$dmb_style = $dmbloodless->option['style'];

return $dmb_style;

}

if ( function_exists(‘register_sidebar’) ) {

register_sidebar(array(‘name’=>’Sidebar 1′,

‘before_widget’ => ‘<div id=”%1$s” class=”data %2$s”>’,

‘after_widget’ => ‘</div>’,

‘before_title’ => ‘<div class=”titles”>’,

‘after_title’ => ‘</div>’,

));

register_sidebar(array(‘name’=>’Sidebar 2′,

‘before_widget’ => ‘<div id=”%1$s” class=”data %2$s”>’,

‘after_widget’ => ‘</div>’,

‘before_title’ => ‘<div class=”titles”>’,

‘after_title’ => ‘</div>’,

));

}

/* default values upon theme install */

if (!$dmbloodless->is_installed()) {

$set_defaults['about'] = ‘Write something about your blog, see theme options for more.';

$set_defaults['style'] = ‘bw';

$result = $dmbloodless->store_options($set_defaults);

}

?>

Last updated: October 7th, 2010.

m4s0n501