<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Cozmoslabs &#187; logo</title>
	<atom:link href="http://www.cozmoslabs.com/tag/logo/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.cozmoslabs.com</link>
	<description>Web design and development experiment.</description>
	<lastBuildDate>Thu, 01 Jul 2010 09:26:25 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
		<item>
		<title>Add a header image to Thematic &#8211; the easy way</title>
		<link>http://www.cozmoslabs.com/2009/05/28/add-a-header-image-to-thematic-the-easy-way/</link>
		<comments>http://www.cozmoslabs.com/2009/05/28/add-a-header-image-to-thematic-the-easy-way/#comments</comments>
		<pubDate>Thu, 28 May 2009 21:48:48 +0000</pubDate>
		<dc:creator>Cristian</dc:creator>
				<category><![CDATA[Thematic]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[child theme]]></category>
		<category><![CDATA[logo]]></category>
		<category><![CDATA[thematic header image]]></category>

		<guid isPermaLink="false">http://www.cozmoslabs.com/?p=471</guid>
		<description><![CDATA[With the various theme hooks and theme filters, now it&#8217;s easier then ever to change the Thematic header with your own logo or custom banner design. Until now you had to either change the header.php file in Thematic (something not really recommended) or use rather ugly CSS tricks to hide the existing content and use [...]


Related posts:<ol><li><a href='http://www.cozmoslabs.com/2009/04/15/add-a-search-box-to-the-thematic-menu/' rel='bookmark' title='Permanent Link: Add a search box to the thematic menu'>Add a search box to the thematic menu</a></li>
<li><a href='http://www.cozmoslabs.com/2009/06/26/thematic-featured-posts/' rel='bookmark' title='Permanent Link: Add &#8220;Featured Posts&#8221; to your Thematic child theme'>Add &#8220;Featured Posts&#8221; to your Thematic child theme</a></li>
<li><a href='http://www.cozmoslabs.com/2010/05/02/thematic-tabbed-widgets/' rel='bookmark' title='Permanent Link: Thematic Tabbed Widgets'>Thematic Tabbed Widgets</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>With the various <em>theme hooks</em> and <em>theme filters</em>, now it&#8217;s easier then ever to <strong>change the <a href="http://themeshaper.com/thematic/">Thematic</a> header</strong> with your own logo or custom banner design. </p>
<p>Until now you had to either change the header.php file in Thematic (something not really recommended) or <a href="http://www.cozmoslabs.com/2008/10/29/installing-wordpress-child-themes-customizing/">use rather ugly CSS tricks</a> to hide the existing content and use your logo or banner as a background for the <em>#header</em> or <em>#branding</em> div.</p>
<p>The end result will be a <strong>Child Theme Options page</strong> that will allow us to select if we want to use the default header or upload a header image:<br />
<div id="attachment_473" class="wp-caption aligncenter" style="width: 610px"><img src="http://www.cozmoslabs.com/wp-content/uploads/2009/05/Untitled-2.jpg" alt="Child Theme Options Page - You now have the posibility to upload your header image from WordPress" title="Untitled-2" width="600" height="354" class="size-full wp-image-473" /><p class="wp-caption-text">Child Theme Options Page - You now have the posibility to upload your header image from WordPress</p></div></p>
<p><span id="more-471"></span></p>
<p>We&#8217;ll start by <a href="http://www.cozmoslabs.com/2008/09/07/use-wordpress-as-a-cms-with-thematic-part1/">creating a Child Theme</a>. If you are already using one of the <a href="http://www.cozmoslabs.com/wordpress-themes/">Thematic Child Themes</a> then you can move to the next step, modifying the <em>functions.php</em> file.</p>
<p>The code for this tutorial was created by my colleague <a href="http://gab.ro/" rel="nofollow">Gabriel</a>. He always helps me with custom programing for WordPress <img src='http://www.cozmoslabs.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> !</p>
<p>This <em>functions.php</em> file will consist of two parts: adding the Child Theme Options page to WordPress and replacing the default header with your own logo or banner image.</p>
<p>Open functions.php and add the following code:</p>
<pre class="brush: php;">
&lt;?php
// ---------- &quot;Child Theme Options&quot; menu STARTS HERE

add_action('admin_menu' , 'childtheme_add_admin');

function childtheme_add_admin() {
	add_submenu_page('themes.php', 'Child Theme Options', 'Child Theme Options', 'edit_themes', basename(__FILE__), 'childtheme_admin');
}

function childtheme_admin() {

	$child_theme_image = get_option('child_theme_image');
	$enabled = get_option('child_theme_logo_enabled');

	if ($_POST['options-submit']){
		$enabled = htmlspecialchars($_POST['enabled']);
		update_option('child_theme_logo_enabled', $enabled);

		$file_name = $_FILES['logo_image']['name'];
		$temp_file = $_FILES['logo_image']['tmp_name'];
		$file_type = $_FILES['logo_image']['type'];

		if($file_type==&quot;image/gif&quot; || $file_type==&quot;image/jpeg&quot; || $file_type==&quot;image/pjpeg&quot; || $file_type==&quot;image/png&quot;){
			$fd = fopen($temp_file,’rb’);
			$file_content=file_get_contents($temp_file);
			fclose($fd);

			$wud = wp_upload_dir();

			if (file_exists($wud[path].'/'.strtolower($file_name))){
				unlink ($wud[path].'/'.strtolower($file_name));
			}

			$upload = wp_upload_bits( $file_name, '', $file_content);
		//	echo $upload['error'];

			$child_theme_image = $wud[url].'/'.strtolower($file_name);
			update_option('child_theme_image', $child_theme_image);
		}

		?&gt;
			&lt;div class=&quot;updated&quot;&gt;&lt;p&gt;Your new options have been successfully saved.&lt;/p&gt;&lt;/div&gt;
		&lt;?php

	}

	if($enabled) $checked='checked=&quot;checked&quot;';

	?&gt;
		&lt;div class=&quot;wrap&quot;&gt;
			&lt;div id=&quot;icon-themes&quot; class=&quot;icon32&quot;&gt;&lt;/div&gt;
			&lt;h2&gt;Child Theme Options&lt;/h2&gt;
			&lt;form name=&quot;theform&quot; method=&quot;post&quot; enctype=&quot;multipart/form-data&quot; action=&quot;&lt;?php echo str_replace( '%7E', '~', $_SERVER['REQUEST_URI']);?&gt;&quot;&gt;
				&lt;table class=&quot;form-table&quot;&gt;
					&lt;tr&gt;
						&lt;td width=&quot;200&quot;&gt;Use logo image instead of blog title and description:&lt;/td&gt;
						&lt;td&gt;&lt;input type=&quot;checkbox&quot; name=&quot;enabled&quot; value=&quot;1&quot; &lt;?php echo $checked; ?&gt;/&gt;&lt;/td&gt;
					&lt;/tr&gt;
					&lt;tr&gt;
						&lt;td&gt;Current image:&lt;/td&gt;
						&lt;td&gt;&lt;img src=&quot;&lt;?php echo $child_theme_image; ?&gt;&quot; /&gt;&lt;/td&gt;
					&lt;/tr&gt;
					&lt;tr&gt;
						&lt;td&gt;Logo image to use (gif/jpeg/png):&lt;/td&gt;
						&lt;td&gt;&lt;input type=&quot;file&quot; name=&quot;logo_image&quot;&gt;&lt;br /&gt;(you must have writing permissions for your uploads directory)&lt;/td&gt;
					&lt;/tr&gt;
				&lt;/table&gt;
				&lt;input type=&quot;hidden&quot; name=&quot;options-submit&quot; value=&quot;1&quot; /&gt;
				&lt;p class=&quot;submit&quot;&gt;&lt;input type=&quot;submit&quot; name=&quot;submit&quot; value=&quot;Save Options&quot; /&gt;&lt;/p&gt;
			&lt;/form&gt;
		&lt;/div&gt;
	&lt;?php
}

// ---------- &quot;Child Theme Options&quot; menu ENDS HERE

// ---------- Adding the logo image to the header STARTS HERE

if(get_option('child_theme_logo_enabled')){
	function remove_thematic_blogtitle() {
	 remove_action('thematic_header','thematic_blogtitle',3);
	}
	add_action('init','remove_thematic_blogtitle');

	function remove_thematic_blogdescription() {
	 remove_action('thematic_header','thematic_blogdescription',5);
	}
	add_action('init','remove_thematic_blogdescription');

	function thematic_logo_image() {
		echo '&lt;div id=&quot;logo-image&quot;&gt;&lt;a href=&quot;'.get_option('home').'&quot;&gt;&lt;img src=&quot;'.get_option('child_theme_image').'&quot; /&gt;&lt;/a&gt;&lt;/div&gt;';
	}
	add_action('thematic_header','thematic_logo_image',4);
}
// ---------- Adding the logo image to the header ENDS HERE
?&gt;
</pre>
<p>This source code works on all Thematic 0.9 Child Themes. If you&#8217;re using an older version of Thematic, chances are this won&#8217;t work.</p>
<p>Save and go into your WordPress admin panel under &#8220;Appearance -> Child Theme Options&#8221;. If every thing worked out ok you should have a similar admin panel as the one in the picture on top of the page.</p>
<p>As a side note there&#8217;s already in the works a <a href="http://www.wupperpiraten.de/2009/05/thematic-configuration-plugin/" rel="nofollow">plugin for WordPress that will make modifying Thematic a breeze</a> so keep an eye out for great new things coming your way!</p>


<p>Related posts:<ol><li><a href='http://www.cozmoslabs.com/2009/04/15/add-a-search-box-to-the-thematic-menu/' rel='bookmark' title='Permanent Link: Add a search box to the thematic menu'>Add a search box to the thematic menu</a></li>
<li><a href='http://www.cozmoslabs.com/2009/06/26/thematic-featured-posts/' rel='bookmark' title='Permanent Link: Add &#8220;Featured Posts&#8221; to your Thematic child theme'>Add &#8220;Featured Posts&#8221; to your Thematic child theme</a></li>
<li><a href='http://www.cozmoslabs.com/2010/05/02/thematic-tabbed-widgets/' rel='bookmark' title='Permanent Link: Thematic Tabbed Widgets'>Thematic Tabbed Widgets</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.cozmoslabs.com/2009/05/28/add-a-header-image-to-thematic-the-easy-way/feed/</wfw:commentRss>
		<slash:comments>148</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Database Caching 4/26 queries in 0.014 seconds using disk

Served from: www.cozmoslabs.com @ 2010-07-31 02:12:06 -->