<?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: Custom Template for Parent and Sub Categories (without a plugin) in WordPress</title>
	<atom:link href="http://www.scriptygoddess.com/archives/2010/03/14/custom-template-for-parent-and-sub-categories-without-a-plugin-in-wordpress/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.scriptygoddess.com/archives/2010/03/14/custom-template-for-parent-and-sub-categories-without-a-plugin-in-wordpress/</link>
	<description></description>
	<lastBuildDate>Tue, 10 Jan 2012 01:21:38 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: Marco Traverso</title>
		<link>http://www.scriptygoddess.com/archives/2010/03/14/custom-template-for-parent-and-sub-categories-without-a-plugin-in-wordpress/comment-page-1/#comment-651639</link>
		<dc:creator>Marco Traverso</dc:creator>
		<pubDate>Tue, 19 Oct 2010 11:51:37 +0000</pubDate>
		<guid isPermaLink="false">http://www.scriptygoddess.com/?p=1632#comment-651639</guid>
		<description>I use a similar solution with a custom function that works also for children categories.

In functions.php I defined:

function is_in_category($cat_name)
{
	//returns true if a post belongs to a category or to one of its children categories
	return  ( in_category($cat_name)&#124;&#124;     post_is_in_descendant_category( get_term_by( &#039;name&#039;, $cat_name, &#039;category&#039; ) ));
}

And in category.php I placed the code:

if(is_in_category(&#039;my_category_slug&#039;))
{
    include&#039;my-cat-template.php&#039;;
}
else
{
    //default code
}</description>
		<content:encoded><![CDATA[<p>I use a similar solution with a custom function that works also for children categories.</p>
<p>In functions.php I defined:</p>
<p>function is_in_category($cat_name)<br />
{<br />
	//returns true if a post belongs to a category or to one of its children categories<br />
	return  ( in_category($cat_name)||     post_is_in_descendant_category( get_term_by( &#039;name&#039;, $cat_name, &#039;category&#039; ) ));<br />
}</p>
<p>And in category.php I placed the code:</p>
<p>if(is_in_category(&#039;my_category_slug&#039;))<br />
{<br />
    include&#039;my-cat-template.php&#039;;<br />
}<br />
else<br />
{<br />
    //default code<br />
}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bridie Macdonald</title>
		<link>http://www.scriptygoddess.com/archives/2010/03/14/custom-template-for-parent-and-sub-categories-without-a-plugin-in-wordpress/comment-page-1/#comment-646925</link>
		<dc:creator>Bridie Macdonald</dc:creator>
		<pubDate>Tue, 11 May 2010 09:46:02 +0000</pubDate>
		<guid isPermaLink="false">http://www.scriptygoddess.com/?p=1632#comment-646925</guid>
		<description>You rock! When creating dynamic sidebars wordpress Codex does not list any way to call children of is_category so I was adding all of the children in an array of  which was PAINFUL to manage - I adapted your code and it works - many thanks!!!!</description>
		<content:encoded><![CDATA[<p>You rock! When creating dynamic sidebars wordpress Codex does not list any way to call children of is_category so I was adding all of the children in an array of  which was PAINFUL to manage &#8211; I adapted your code and it works &#8211; many thanks!!!!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: dandy</title>
		<link>http://www.scriptygoddess.com/archives/2010/03/14/custom-template-for-parent-and-sub-categories-without-a-plugin-in-wordpress/comment-page-1/#comment-646201</link>
		<dc:creator>dandy</dc:creator>
		<pubDate>Mon, 19 Apr 2010 16:39:30 +0000</pubDate>
		<guid isPermaLink="false">http://www.scriptygoddess.com/?p=1632#comment-646201</guid>
		<description>thanks for that. alot. I was needing it desperately.

Thanks.</description>
		<content:encoded><![CDATA[<p>thanks for that. alot. I was needing it desperately.</p>
<p>Thanks.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: darimata</title>
		<link>http://www.scriptygoddess.com/archives/2010/03/14/custom-template-for-parent-and-sub-categories-without-a-plugin-in-wordpress/comment-page-1/#comment-645983</link>
		<dc:creator>darimata</dc:creator>
		<pubDate>Mon, 12 Apr 2010 09:32:03 +0000</pubDate>
		<guid isPermaLink="false">http://www.scriptygoddess.com/?p=1632#comment-645983</guid>
		<description>great tips...!
I have around 25 sub-categories in one parent and this is exactly what i need... :D

Thanks, Jennifer..</description>
		<content:encoded><![CDATA[<p>great tips&#8230;!<br />
I have around 25 sub-categories in one parent and this is exactly what i need&#8230; <img src='http://www.scriptygoddess.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
<p>Thanks, Jennifer..</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Montana Flynn</title>
		<link>http://www.scriptygoddess.com/archives/2010/03/14/custom-template-for-parent-and-sub-categories-without-a-plugin-in-wordpress/comment-page-1/#comment-645770</link>
		<dc:creator>Montana Flynn</dc:creator>
		<pubDate>Fri, 02 Apr 2010 21:53:20 +0000</pubDate>
		<guid isPermaLink="false">http://www.scriptygoddess.com/?p=1632#comment-645770</guid>
		<description>Great, just what I was looking for!</description>
		<content:encoded><![CDATA[<p>Great, just what I was looking for!</p>
]]></content:encoded>
	</item>
</channel>
</rss>

