<?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>Sat, 13 Mar 2010 18:22:47 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<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-page-1/#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-page-1/#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(&#8216;16&#8242;) ) { xx<br />
           xxphp include (&#8217;sidebar3.php&#8217;); xx<br />
xxphp } xx</p>
<p>xxphp if ( in_category(&#8216;11&#8242;) ) { xx<br />
           xxphp include (&#8217;sidebar4.php&#8217;); xx<br />
xxphp } xx</p>
<p>xxphp if ( in_category(&#8216;13&#8242;) ) { xx<br />
           xxphp include (&#8217;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-page-1/#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(&#8216;16&#8242;) ) { ?&gt;</p>
<p>php } ?&gt;</p>
<p>php if ( in_category(&#8216;11&#8242;) ) { ?&gt;</p>
<p>           php include (&#8217;sidebar4.php&#8217;); ?&gt;</p>
<p>php } ?&gt;</p>
<p>php if ( in_category(&#8216;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-page-1/#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>
	<item>
		<title>By: Ryan</title>
		<link>http://wpgarage.com/tips/giving-different-styles-to-different-wordpress-categories/comment-page-1/#comment-422</link>
		<dc:creator>Ryan</dc:creator>
		<pubDate>Fri, 14 Dec 2007 22:13:04 +0000</pubDate>
		<guid isPermaLink="false">http://wordpressgarage.com/tips/giving-different-styles-to-different-wordpress-categories/#comment-422</guid>
		<description>I&#039;m a little confused. The PHP you have above should work fine, although you may end up with two sidebars if it is in categories 18 and 17, but you should be able to get around that by using an elseif instead of an if for category 17.

Or maybe I&#039;ve missed what you are trying to do, I&#039;m not sure.</description>
		<content:encoded><![CDATA[<p>I&#8217;m a little confused. The PHP you have above should work fine, although you may end up with two sidebars if it is in categories 18 and 17, but you should be able to get around that by using an elseif instead of an if for category 17.</p>
<p>Or maybe I&#8217;ve missed what you are trying to do, I&#8217;m not sure.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Marcus O'Donnell</title>
		<link>http://wpgarage.com/tips/giving-different-styles-to-different-wordpress-categories/comment-page-1/#comment-421</link>
		<dc:creator>Marcus O'Donnell</dc:creator>
		<pubDate>Fri, 14 Dec 2007 20:52:32 +0000</pubDate>
		<guid isPermaLink="false">http://wordpressgarage.com/tips/giving-different-styles-to-different-wordpress-categories/#comment-421</guid>
		<description>The php code didn&#039;t show up in the comment post I will try removing all of the opening and closing &lt;?

php if ( in_category(&#039;18&#039;) ) {
           php include (&#039;sidebar3.php&#039;);
 php }

php if ( in_category(&#039;17&#039;) ) {
           &lt;?php include (&#039;sidebar2.php&#039;);
php } else {

php get_sidebar();

 php }</description>
		<content:encoded><![CDATA[<p>The php code didn&#8217;t show up in the comment post I will try removing all of the opening and closing &lt;?</p>
<p>php if ( in_category(&#8216;18&#8242;) ) {<br />
           php include (&#8217;sidebar3.php&#8217;);<br />
 php }</p>
<p>php if ( in_category(&#8216;17&#8242;) ) {<br />
           &lt;?php include (&#8217;sidebar2.php&#8217;);<br />
php } else {</p>
<p>php get_sidebar();</p>
<p> php }</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Marcus O'Donnell</title>
		<link>http://wpgarage.com/tips/giving-different-styles-to-different-wordpress-categories/comment-page-1/#comment-423</link>
		<dc:creator>Marcus O'Donnell</dc:creator>
		<pubDate>Fri, 14 Dec 2007 20:45:42 +0000</pubDate>
		<guid isPermaLink="false">http://wordpressgarage.com/tips/giving-different-styles-to-different-wordpress-categories/#comment-423</guid>
		<description>Hi Miriam

Thanks for your quick reply.

I have progressed a little already but still having problems.

What I want to do with certain categories is to replace the normal sidebar with a completely different set of information. It may be a set of specific links that relate to that category or it may be some general text that relates to that category - if for example the category is about a specific project there might be a general project description and I might not want the general rest of site stuff. Essentially I want the same flexibility that I can have by choosing different page templates for different individual pages.

I can see this working in a range of situations but I have a particular site that I am working on at the moment where this would be helpful because some of the categories indicate a kind of sub-publication.

One way that i can get close to this is by adding in some code to the single.php at the end:













This does work but there is one problem. Posts with multiple categories. I could live with that and be more discriminating in my category distribution (use tags instead for instance) but in one particular instance this doesn&#039;t work. The mimbo theme uses categories to place the &quot;Lead&quot; and &quot;featured&quot; articles in certain places so these articles will always have two categories.

My problem with using the above syntax is that it works perfectly if you only want to do it once because the code seems to read

&quot;if this post is in category x then use this special category x sidebar but everywhere else use the normal sidebar&quot;

If a lead post (cat-3) is also category x then I get the beautiful category specific sidebar - it seems to ignore the multiple categories.

However in the above example if I am trying to do it in multiple categories it has problems because if I have a category 18 post as the Lead (also cat-3) and a category 17 post as one of the featured (also cat 4) in the first mentioned category I get both the normal and the special sidebar while in the second mentioned category I get what I want - only the special sidebar.

Again I gather (I am a real php newbie) this is because the code is reading

&quot;if this post is in category 18 then use this special category 18 sidebar&quot;

&quot;&quot;if this post is in category 17 then use this special category 17 sidebar but everywhere else use the normal sidebar&quot;

And because in this case the post is coded cat 3 and cat 18 I end up with both side bars because the theme is reading the second &quot;everywhere else&quot; as only relating to the last mentioned cat and it thinks - oh cat 3 put the normal sidebar.

I need code that says

&quot;if this post is in category x then use this special category x sidebar

&quot;if this post is in category y then use this special category y sidebar

&quot;if this post is in category z then use this special category z sidebar

but if none of the above use the normal sidebar&quot;

Sorry this was so long!

I notice on the wordpress forums there are similar questions that are unresolved so if you have a solution I think there are others who would be interested too.

Thanks

Marcus</description>
		<content:encoded><![CDATA[<p>Hi Miriam</p>
<p>Thanks for your quick reply.</p>
<p>I have progressed a little already but still having problems.</p>
<p>What I want to do with certain categories is to replace the normal sidebar with a completely different set of information. It may be a set of specific links that relate to that category or it may be some general text that relates to that category &#8211; if for example the category is about a specific project there might be a general project description and I might not want the general rest of site stuff. Essentially I want the same flexibility that I can have by choosing different page templates for different individual pages.</p>
<p>I can see this working in a range of situations but I have a particular site that I am working on at the moment where this would be helpful because some of the categories indicate a kind of sub-publication.</p>
<p>One way that i can get close to this is by adding in some code to the single.php at the end:</p>
<p>This does work but there is one problem. Posts with multiple categories. I could live with that and be more discriminating in my category distribution (use tags instead for instance) but in one particular instance this doesn&#8217;t work. The mimbo theme uses categories to place the &#8220;Lead&#8221; and &#8220;featured&#8221; articles in certain places so these articles will always have two categories.</p>
<p>My problem with using the above syntax is that it works perfectly if you only want to do it once because the code seems to read</p>
<p>&#8220;if this post is in category x then use this special category x sidebar but everywhere else use the normal sidebar&#8221;</p>
<p>If a lead post (cat-3) is also category x then I get the beautiful category specific sidebar &#8211; it seems to ignore the multiple categories.</p>
<p>However in the above example if I am trying to do it in multiple categories it has problems because if I have a category 18 post as the Lead (also cat-3) and a category 17 post as one of the featured (also cat 4) in the first mentioned category I get both the normal and the special sidebar while in the second mentioned category I get what I want &#8211; only the special sidebar.</p>
<p>Again I gather (I am a real php newbie) this is because the code is reading</p>
<p>&#8220;if this post is in category 18 then use this special category 18 sidebar&#8221;</p>
<p>&#8220;&#8221;if this post is in category 17 then use this special category 17 sidebar but everywhere else use the normal sidebar&#8221;</p>
<p>And because in this case the post is coded cat 3 and cat 18 I end up with both side bars because the theme is reading the second &#8220;everywhere else&#8221; as only relating to the last mentioned cat and it thinks &#8211; oh cat 3 put the normal sidebar.</p>
<p>I need code that says</p>
<p>&#8220;if this post is in category x then use this special category x sidebar</p>
<p>&#8220;if this post is in category y then use this special category y sidebar</p>
<p>&#8220;if this post is in category z then use this special category z sidebar</p>
<p>but if none of the above use the normal sidebar&#8221;</p>
<p>Sorry this was so long!</p>
<p>I notice on the wordpress forums there are similar questions that are unresolved so if you have a solution I think there are others who would be interested too.</p>
<p>Thanks</p>
<p>Marcus</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Miriam</title>
		<link>http://wpgarage.com/tips/giving-different-styles-to-different-wordpress-categories/comment-page-1/#comment-425</link>
		<dc:creator>Miriam</dc:creator>
		<pubDate>Thu, 13 Dec 2007 06:18:31 +0000</pubDate>
		<guid isPermaLink="false">http://wordpressgarage.com/tips/giving-different-styles-to-different-wordpress-categories/#comment-425</guid>
		<description>Hi Marcus - glad to see you here at WPG!

Can you clarify what type of information you would want to have appear in the sidebar? If it&#039;s related to the category that the post is in, there may be a way to have category-specific information appear there.

Nice implementation of the Mimbo theme, by the way.</description>
		<content:encoded><![CDATA[<p>Hi Marcus &#8211; glad to see you here at WPG!</p>
<p>Can you clarify what type of information you would want to have appear in the sidebar? If it&#8217;s related to the category that the post is in, there may be a way to have category-specific information appear there.</p>
<p>Nice implementation of the Mimbo theme, by the way.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Marcus O'Donnell</title>
		<link>http://wpgarage.com/tips/giving-different-styles-to-different-wordpress-categories/comment-page-1/#comment-424</link>
		<dc:creator>Marcus O'Donnell</dc:creator>
		<pubDate>Thu, 13 Dec 2007 05:55:42 +0000</pubDate>
		<guid isPermaLink="false">http://wordpressgarage.com/tips/giving-different-styles-to-different-wordpress-categories/#comment-424</guid>
		<description>I thought this was the post that was going to solve all my problems but after giving it a go I dont think so. But maybe you can help

I am looking for a way of giving each category its own distinctive sidebar. So that when you call up a single post from a particular category  you get a particular set of information in the sidebar that varies for each category.

The theme I use already calls up a More posts from this category but I am unsure how to take this further

you can do this really easily with pages by calling a different page template but I have searched around and can&#039;t seem to find a way of doing it with posts

hope you or your readers might have a simple elegant solution

thanks - I am learning lots from your site</description>
		<content:encoded><![CDATA[<p>I thought this was the post that was going to solve all my problems but after giving it a go I dont think so. But maybe you can help</p>
<p>I am looking for a way of giving each category its own distinctive sidebar. So that when you call up a single post from a particular category  you get a particular set of information in the sidebar that varies for each category.</p>
<p>The theme I use already calls up a More posts from this category but I am unsure how to take this further</p>
<p>you can do this really easily with pages by calling a different page template but I have searched around and can&#8217;t seem to find a way of doing it with posts</p>
<p>hope you or your readers might have a simple elegant solution</p>
<p>thanks &#8211; I am learning lots from your site</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: links for 2007-10-27 &#124; hansi.unblogged</title>
		<link>http://wpgarage.com/tips/giving-different-styles-to-different-wordpress-categories/comment-page-1/#comment-417</link>
		<dc:creator>links for 2007-10-27 &#124; hansi.unblogged</dc:creator>
		<pubDate>Sat, 27 Oct 2007 23:31:01 +0000</pubDate>
		<guid isPermaLink="false">http://wordpressgarage.com/tips/giving-different-styles-to-different-wordpress-categories/#comment-417</guid>
		<description>[...] Giving different styles to different WordPress categories » WordPressGarage.com WordPress allows you to give different styles to different categories in a range of ways. You can style a category page: this means that every category page can have its own unique style. For example, let’s say you have a site about vegetables, where ev (tags: design tutorials wordpress css) [...]</description>
		<content:encoded><![CDATA[<p>[...] Giving different styles to different WordPress categories » WordPressGarage.com WordPress allows you to give different styles to different categories in a range of ways. You can style a category page: this means that every category page can have its own unique style. For example, let’s say you have a site about vegetables, where ev (tags: design tutorials wordpress css) [...]</p>
]]></content:encoded>
	</item>
</channel>
</rss>
