<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: Giving different styles to different WordPress categories</title>
	<atom:link href="http://wpgarage.com/tips/giving-different-styles-to-different-wordpress-categories/feed/" rel="self" type="application/rss+xml" />
	<link>http://wpgarage.com/tips/giving-different-styles-to-different-wordpress-categories/</link>
	<description>wordpress tricks, hacks, and tips</description>
	<lastBuildDate>Wed, 09 May 2012 06:53:59 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
	<item>
		<title>By: rotem</title>
		<link>http://wpgarage.com/tips/giving-different-styles-to-different-wordpress-categories/#comment-62460</link>
		<dc:creator>rotem</dc:creator>
		<pubDate>Sun, 12 Jun 2011 09:51:54 +0000</pubDate>
		<guid isPermaLink="false">http://wordpressgarage.com/tips/giving-different-styles-to-different-wordpress-categories/#comment-62460</guid>
		<description>hi !
can i do different sidebar in each page ?
different (text)
thank you</description>
		<content:encoded><![CDATA[<p>hi !<br />
can i do different sidebar in each page ?<br />
different (text)<br />
thank you</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Hello Fellow Coder &#124; Philjutsu</title>
		<link>http://wpgarage.com/tips/giving-different-styles-to-different-wordpress-categories/#comment-62234</link>
		<dc:creator>Hello Fellow Coder &#124; Philjutsu</dc:creator>
		<pubDate>Mon, 21 Mar 2011 01:27:10 +0000</pubDate>
		<guid isPermaLink="false">http://wordpressgarage.com/tips/giving-different-styles-to-different-wordpress-categories/#comment-62234</guid>
		<description>[...] useful link that I referenced to get this blog&#8217;s design to work with the different categories:Giving different styles to different WordPress categories.Think outside the [...]</description>
		<content:encoded><![CDATA[<p>[...] useful link that I referenced to get this blog&#8217;s design to work with the different categories:Giving different styles to different WordPress categories.Think outside the [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Alexcp</title>
		<link>http://wpgarage.com/tips/giving-different-styles-to-different-wordpress-categories/#comment-61785</link>
		<dc:creator>Alexcp</dc:creator>
		<pubDate>Fri, 12 Nov 2010 16:56:28 +0000</pubDate>
		<guid isPermaLink="false">http://wordpressgarage.com/tips/giving-different-styles-to-different-wordpress-categories/#comment-61785</guid>
		<description>Like Marz said, you can use a conditional tag instead. I think this technique is better and you can easily customize it.
For example I use so I can repeat a template on multiple child category.
 
To do it, first save the content of the category.php file as category_default.php
then in category.php delete eveything and replace it with:

&lt;?php
$post = $wp_query-&gt;post;
if (in_category(&#039;catname1&#039;)) {
include(TEMPLATEPATH.&#039;/catname1.php&#039;);
} elseif (in_category(&#039;catname1&#039;)) {
include(TEMPLATEPATH.&#039;/catname2.php&#039;);
}
else{
include(TEMPLATEPATH.&#039;/category_default.php&#039;);
}
?&gt;
</description>
		<content:encoded><![CDATA[<p>Like Marz said, you can use a conditional tag instead. I think this technique is better and you can easily customize it.<br />
For example I use so I can repeat a template on multiple child category.<br />
 <br />
To do it, first save the content of the category.php file as category_default.php<br />
then in category.php delete eveything and replace it with:</p>
<p>&lt;?php<br />
$post = $wp_query-&gt;post;<br />
if (in_category(&#8216;catname1&#8242;)) {<br />
include(TEMPLATEPATH.&#8217;/catname1.php&#8217;);<br />
} elseif (in_category(&#8216;catname1&#8242;)) {<br />
include(TEMPLATEPATH.&#8217;/catname2.php&#8217;);<br />
}<br />
else{<br />
include(TEMPLATEPATH.&#8217;/category_default.php&#8217;);<br />
}<br />
?&gt;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Marz</title>
		<link>http://wpgarage.com/tips/giving-different-styles-to-different-wordpress-categories/#comment-61526</link>
		<dc:creator>Marz</dc:creator>
		<pubDate>Thu, 12 Aug 2010 20:14:54 +0000</pubDate>
		<guid isPermaLink="false">http://wordpressgarage.com/tips/giving-different-styles-to-different-wordpress-categories/#comment-61526</guid>
		<description>why not using a conditional in header.php?
&lt;?php if ( is_page(array(&#039;page-name&#039;,&#039;page-name&#039;)) ) { ?&gt;
&lt;link rel=&quot;stylesheet&quot; href=&quot;/wp-content/themes/theme-name/style-2.css&quot; type=&quot;text/css&quot; media=&quot;screen&quot; /&gt;
&lt;?php } else { ?&gt;
&lt;link rel=&quot;stylesheet&quot; href=&quot;&lt;?php bloginfo(&#039;stylesheet_url&#039;); ?&gt;&quot; type=&quot;text/css&quot; media=&quot;screen&quot; /&gt;
&lt;?php } ?&gt;</description>
		<content:encoded><![CDATA[<p>why not using a conditional in header.php?<br />
&lt;?php if ( is_page(array(&#8216;page-name&#8217;,'page-name&#8217;)) ) { ?&gt;<br />
&lt;link rel=&#8221;stylesheet&#8221; href=&#8221;/wp-content/themes/theme-name/style-2.css&#8221; type=&#8221;text/css&#8221; media=&#8221;screen&#8221; /&gt;<br />
&lt;?php } else { ?&gt;<br />
&lt;link rel=&#8221;stylesheet&#8221; href=&#8221;&lt;?php bloginfo(&#8216;stylesheet_url&#8217;); ?&gt;&#8221; type=&#8221;text/css&#8221; media=&#8221;screen&#8221; /&gt;<br />
&lt;?php } ?&gt;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Using WordPress Categories To Style Posts &#171; Lorelle on WordPress</title>
		<link>http://wpgarage.com/tips/giving-different-styles-to-different-wordpress-categories/#comment-61498</link>
		<dc:creator>Using WordPress Categories To Style Posts &#171; Lorelle on WordPress</dc:creator>
		<pubDate>Sun, 25 Jul 2010 21:31:13 +0000</pubDate>
		<guid isPermaLink="false">http://wordpressgarage.com/tips/giving-different-styles-to-different-wordpress-categories/#comment-61498</guid>
		<description>[...] Giving different styles to different WordPress categories : WP Garage [...]</description>
		<content:encoded><![CDATA[<p>[...] Giving different styles to different WordPress categories : WP Garage [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Greg</title>
		<link>http://wpgarage.com/tips/giving-different-styles-to-different-wordpress-categories/#comment-61123</link>
		<dc:creator>Greg</dc:creator>
		<pubDate>Mon, 26 Apr 2010 18:36:53 +0000</pubDate>
		<guid isPermaLink="false">http://wordpressgarage.com/tips/giving-different-styles-to-different-wordpress-categories/#comment-61123</guid>
		<description>Regarding the styling as per the original post topic, It might be more useful to put the PHP conditionals into some inline CSS, or set them to include separate stylesheets. Pseudo-code:
if (category=carrots) {echo style tag with some inline CSS}
or
if (category=carrots) {echo a line to include carrots.css}
The nice thing about doing it that way is that you&#039;re not hard-coding anything into the template. What if your post itself contains H2 tags? In the example for the article, only that top H2 tag, the one that&#039;s part of the template, would be styled. By including some CSS inline or in a separate sheet, you could have it such that ALL H2 tags are styled with the appropriate colour, as well as any other tags (anchor links? strong tags?) that might want additional category-specific styling.
Regarding the conversation in the comments:
The independent ifs in the code provided in the comments are going to cause problems. You need to decide the hierarchy of which to include in the event that it belongs to more than one category.
The pseudo-code would have to look like:
if (category 1) {include sidebar 1;
}elseif (category 18) {include sidebar 18;
}elseif  (category 5) {include sidebar 5;
}else {include default sidebar;}
In that example, once it sees category 1, that&#039;s it. If there&#039;s no category 1 but there is category 18, that&#039;s it. If there&#039;s no category 1 or 18 but there is category 5, that&#039;s it. Otherwise it will use default.
Good ideas all around, though! I apologize if my pseudo-code doesn&#039;t result in any actual practical code! Since I&#039;m working on an implementation myself, if I discover the answer in hard, practical code, I&#039;ll provide it back here. :-)</description>
		<content:encoded><![CDATA[<p>Regarding the styling as per the original post topic, It might be more useful to put the PHP conditionals into some inline CSS, or set them to include separate stylesheets. Pseudo-code:<br />
if (category=carrots) {echo style tag with some inline CSS}<br />
or<br />
if (category=carrots) {echo a line to include carrots.css}<br />
The nice thing about doing it that way is that you&#8217;re not hard-coding anything into the template. What if your post itself contains H2 tags? In the example for the article, only that top H2 tag, the one that&#8217;s part of the template, would be styled. By including some CSS inline or in a separate sheet, you could have it such that ALL H2 tags are styled with the appropriate colour, as well as any other tags (anchor links? strong tags?) that might want additional category-specific styling.<br />
Regarding the conversation in the comments:<br />
The independent ifs in the code provided in the comments are going to cause problems. You need to decide the hierarchy of which to include in the event that it belongs to more than one category.<br />
The pseudo-code would have to look like:<br />
if (category 1) {include sidebar 1;<br />
}elseif (category 18) {include sidebar 18;<br />
}elseif  (category 5) {include sidebar 5;<br />
}else {include default sidebar;}<br />
In that example, once it sees category 1, that&#8217;s it. If there&#8217;s no category 1 but there is category 18, that&#8217;s it. If there&#8217;s no category 1 or 18 but there is category 5, that&#8217;s it. Otherwise it will use default.<br />
Good ideas all around, though! I apologize if my pseudo-code doesn&#8217;t result in any actual practical code! Since I&#8217;m working on an implementation myself, if I discover the answer in hard, practical code, I&#8217;ll provide it back here. <img src='http://wpgarage.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Content Management with WordPress &#124; Good Approach Marketing</title>
		<link>http://wpgarage.com/tips/giving-different-styles-to-different-wordpress-categories/#comment-60466</link>
		<dc:creator>Content Management with WordPress &#124; Good Approach Marketing</dc:creator>
		<pubDate>Mon, 09 Nov 2009 01:18:15 +0000</pubDate>
		<guid isPermaLink="false">http://wordpressgarage.com/tips/giving-different-styles-to-different-wordpress-categories/#comment-60466</guid>
		<description>[...] For WordPress users it’s easy to understand that you can change the entire look to your website but changing the theme. But what if you want different themes or styles for different categories or pages? You can create customized category templates that will assume a style for certain categories. [...]</description>
		<content:encoded><![CDATA[<p>[...] For WordPress users it’s easy to understand that you can change the entire look to your website but changing the theme. But what if you want different themes or styles for different categories or pages? You can create customized category templates that will assume a style for certain categories. [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Marcus O'Donnell</title>
		<link>http://wpgarage.com/tips/giving-different-styles-to-different-wordpress-categories/#comment-420</link>
		<dc:creator>Marcus O'Donnell</dc:creator>
		<pubDate>Sat, 15 Dec 2007 02:25:43 +0000</pubDate>
		<guid isPermaLink="false">http://wordpressgarage.com/tips/giving-different-styles-to-different-wordpress-categories/#comment-420</guid>
		<description>Still not right all the  replaced with xx just in case my synatx is wrong

xxphp if ( in_category(&#039;16&#039;) ) { xx
           xxphp include (&#039;sidebar3.php&#039;); xx
xxphp } xx

xxphp if ( in_category(&#039;11&#039;) ) { xx
           xxphp include (&#039;sidebar4.php&#039;); xx
xxphp } xx

xxphp if ( in_category(&#039;13&#039;) ) { xx
           xxphp include (&#039;sidebar2.php&#039;); xx
xxphp }else { xx

xxphp get_sidebar(); xx</description>
		<content:encoded><![CDATA[<p>Still not right all the  replaced with xx just in case my synatx is wrong</p>
<p>xxphp if ( in_category(&#8217;16&#8242;) ) { xx<br />
           xxphp include (&#8216;sidebar3.php&#8217;); xx<br />
xxphp } xx</p>
<p>xxphp if ( in_category(&#8217;11&#8242;) ) { xx<br />
           xxphp include (&#8216;sidebar4.php&#8217;); xx<br />
xxphp } xx</p>
<p>xxphp if ( in_category(&#8217;13&#8242;) ) { xx<br />
           xxphp include (&#8216;sidebar2.php&#8217;); xx<br />
xxphp }else { xx</p>
<p>xxphp get_sidebar(); xx</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Marcus O'Donnell</title>
		<link>http://wpgarage.com/tips/giving-different-styles-to-different-wordpress-categories/#comment-419</link>
		<dc:creator>Marcus O'Donnell</dc:creator>
		<pubDate>Sat, 15 Dec 2007 02:17:25 +0000</pubDate>
		<guid isPermaLink="false">http://wordpressgarage.com/tips/giving-different-styles-to-different-wordpress-categories/#comment-419</guid>
		<description>Forgot the code wouldn&#039;t print (is there a way around that???)

php if ( in_category(&#039;16&#039;) ) { ?&gt;


php } ?&gt;



php if ( in_category(&#039;11&#039;) ) { ?&gt;

           php include (&#039;sidebar4.php&#039;); ?&gt;

php } ?&gt;



php if ( in_category(&#039;13&#039;) ) { ?&gt;



php }else { ?&gt;



php get_sidebar(); ?&gt;</description>
		<content:encoded><![CDATA[<p>Forgot the code wouldn&#8217;t print (is there a way around that???)</p>
<p>php if ( in_category(&#8217;16&#8242;) ) { ?&gt;</p>
<p>php } ?&gt;</p>
<p>php if ( in_category(&#8217;11&#8242;) ) { ?&gt;</p>
<p>           php include (&#8216;sidebar4.php&#8217;); ?&gt;</p>
<p>php } ?&gt;</p>
<p>php if ( in_category(&#8217;13&#8242;) ) { ?&gt;</p>
<p>php }else { ?&gt;</p>
<p>php get_sidebar(); ?&gt;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Marcus O'Donnell</title>
		<link>http://wpgarage.com/tips/giving-different-styles-to-different-wordpress-categories/#comment-418</link>
		<dc:creator>Marcus O'Donnell</dc:creator>
		<pubDate>Sat, 15 Dec 2007 02:15:39 +0000</pubDate>
		<guid isPermaLink="false">http://wordpressgarage.com/tips/giving-different-styles-to-different-wordpress-categories/#comment-418</guid>
		<description>Hi Ryan

thanks for trying to help I changed the &quot;else&quot; to &quot;elseif&quot; and i ended up with an error message

I have put up a test site so that you can see what i mean

http://blogsperiment.com

if you click on Amiel&#039;s story which is categorised as Lead Story (cat-7) as well as Paper Rock (cat-13) you get what I want - the story with its own sidebar

but if you click on J Student Blogs for NYT which is categorised as Currently Featured (cat-4) and Tide (cat-16) you ended up with the special Tide sidebar and the normal one below it

same with the bottom story in the second column Images of Cronulla you get the special News Photography (cat-11) side bar as well as the normal one

the current code on the single page is

&lt;code&gt;


















 &lt;/code&gt;

so the only category that is excluding the normal sidebar is the one closest to the &quot;else&quot; statement

any ideas?

thanks so much for the help</description>
		<content:encoded><![CDATA[<p>Hi Ryan</p>
<p>thanks for trying to help I changed the &#8220;else&#8221; to &#8220;elseif&#8221; and i ended up with an error message</p>
<p>I have put up a test site so that you can see what i mean</p>
<p><a href="http://blogsperiment.com" rel="nofollow">http://blogsperiment.com</a></p>
<p>if you click on Amiel&#8217;s story which is categorised as Lead Story (cat-7) as well as Paper Rock (cat-13) you get what I want &#8211; the story with its own sidebar</p>
<p>but if you click on J Student Blogs for NYT which is categorised as Currently Featured (cat-4) and Tide (cat-16) you ended up with the special Tide sidebar and the normal one below it</p>
<p>same with the bottom story in the second column Images of Cronulla you get the special News Photography (cat-11) side bar as well as the normal one</p>
<p>the current code on the single page is</p>
<p><code></p>
<p> </code></p>
<p>so the only category that is excluding the normal sidebar is the one closest to the &#8220;else&#8221; statement</p>
<p>any ideas?</p>
<p>thanks so much for the help</p>
]]></content:encoded>
	</item>
</channel>
</rss>

