Update 2011-09-18: This post is out of date. See the latest release here.
I’ve been maintaining my own hacked-up theme based on Tarski for several years now. This required modifying the theme source, which meant that every update to Tarski would overwrite my customisations. The better way to do this is to write a child theme.
Behold Tolarski, a Tarski child theme for variable width. Tolarski isn’t intended for general release, and I don’t intend to support it for external use. However, I regularly get questions from people wanting to know how I did it, so I’m making the code available.
The details are similar to my previous blog post. The variable-width columns are implemented in CSS, and the header images are positioned in CSS and implemented by a new function which modifies th_header. Tolarski ignores the WordPress “header image” setting.
From functions.php:
function tolarski_headerimage() {
$header_img_url_base = get_bloginfo('stylesheet_directory') . '/headers/';
echo "
<div id=\"header-image\">
<img alt=\"Header image\" src=\"".$header_img_url_base."/tolaris_level1_black.png\" id=\"header_image_blackbg\" />
<img alt=\"Header image\" src=\"".$header_img_url_base."/tolaris_level2_blue.png\" id=\"header_image_bluebg\" />
<img alt=\"Header image\" src=\"".$header_img_url_base."/tolaris_level3_gradient.png\" id=\"header_image_gradient\" />
<img alt=\"Header image\" src=\"".$header_img_url_base."/tolaris_level4_cmda.png\" id=\"header_image_cmd\" />
<img alt=\"Header image\" src=\"".$header_img_url_base."/tolaris_level5_sat.png\" id=\"header_image_satellite\" />
<img alt=\"Header image\" src=\"".$header_img_url_base."/tolaris_level6_science.png\" id=\"header_image_engineer\" />
<img alt=\"Header image\" src=\"".$header_img_url_base."/tolaris_level7_tolaris.png\" id=\"header_image_tolaris\" />
</div>\n\n";
}
function init_tolarski_header() {
remove_all_actions('th_header');
add_action('th_header', 'tolarski_headerimage');
add_action('th_header', 'tarski_titleandtag');
add_action('th_header', 'navbar_wrapper');
add_action('th_header', 'tarski_next_prev_posts');
}
add_action('init', 'init_tolarski_header');
To use Tolarski, you’re going to have to modify tolarski_headerimage(). This specifies the 7 header images by filename, which should be placed in tolarski/headers/. Please don’t use my images on your live blog, but if you just want to play with the theme you can find links in the page source.
Leave a Reply