<?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: Finding a Category Ancestor / Descendant for WP Templates</title>
	<atom:link href="http://www.mummey.org/2009/03/finding-a-category-ancestor-descendant-wp-templates/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.mummey.org/2009/03/finding-a-category-ancestor-descendant-wp-templates/</link>
	<description>Personal Website of Adrian Mummey</description>
	<lastBuildDate>Sat, 20 Feb 2010 17:04:54 -0800</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.5</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: alex</title>
		<link>http://www.mummey.org/2009/03/finding-a-category-ancestor-descendant-wp-templates/comment-page-1/#comment-503</link>
		<dc:creator>alex</dc:creator>
		<pubDate>Thu, 20 Aug 2009 15:08:57 +0000</pubDate>
		<guid isPermaLink="false">http://www.mummey.org/?p=365#comment-503</guid>
		<description>I&#039;m looking desperatly for a way to check if the _currently_ displayed category is a child of a certain category.

Can this function be used to achieve that?
As far as I understand it, it only checks 2 specific categories right?</description>
		<content:encoded><![CDATA[<p>I&#8217;m looking desperatly for a way to check if the _currently_ displayed category is a child of a certain category.</p>
<p>Can this function be used to achieve that?<br />
As far as I understand it, it only checks 2 specific categories right?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Hellen</title>
		<link>http://www.mummey.org/2009/03/finding-a-category-ancestor-descendant-wp-templates/comment-page-1/#comment-298</link>
		<dc:creator>Hellen</dc:creator>
		<pubDate>Wed, 03 Jun 2009 18:50:32 +0000</pubDate>
		<guid isPermaLink="false">http://www.mummey.org/?p=365#comment-298</guid>
		<description>Huge thanks!! This is exactly what I was trying to do. But the only ancestor test I found on my own was the cat_is_ancestor_of function in the WP Codex at http://codex.wordpress.org/Function_Reference/cat_is_ancestor_of. And I was having a horrible time getting it to work. You just made my template writing life sooooo much easier!</description>
		<content:encoded><![CDATA[<p>Huge thanks!! This is exactly what I was trying to do. But the only ancestor test I found on my own was the cat_is_ancestor_of function in the WP Codex at <a href="http://codex.wordpress.org/Function_Reference/cat_is_ancestor_of" rel="nofollow">http://codex.wordpress.org/Function_Reference/cat_is_ancestor_of</a>. And I was having a horrible time getting it to work. You just made my template writing life sooooo much easier!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Daniel</title>
		<link>http://www.mummey.org/2009/03/finding-a-category-ancestor-descendant-wp-templates/comment-page-1/#comment-188</link>
		<dc:creator>Daniel</dc:creator>
		<pubDate>Mon, 20 Apr 2009 22:50:27 +0000</pubDate>
		<guid isPermaLink="false">http://www.mummey.org/?p=365#comment-188</guid>
		<description>Thanks a lot Adrian!</description>
		<content:encoded><![CDATA[<p>Thanks a lot Adrian!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Max</title>
		<link>http://www.mummey.org/2009/03/finding-a-category-ancestor-descendant-wp-templates/comment-page-1/#comment-184</link>
		<dc:creator>Max</dc:creator>
		<pubDate>Wed, 15 Apr 2009 00:58:02 +0000</pubDate>
		<guid isPermaLink="false">http://www.mummey.org/?p=365#comment-184</guid>
		<description>thanks!</description>
		<content:encoded><![CDATA[<p>thanks!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Adrian Mummey</title>
		<link>http://www.mummey.org/2009/03/finding-a-category-ancestor-descendant-wp-templates/comment-page-1/#comment-127</link>
		<dc:creator>Adrian Mummey</dc:creator>
		<pubDate>Tue, 31 Mar 2009 04:50:02 +0000</pubDate>
		<guid isPermaLink="false">http://www.mummey.org/?p=365#comment-127</guid>
		<description>Yes just run the code twice, something like this: 
&lt;code&gt;if(is_category()){
  $ancestor_cat_id_1 = 43;
  $ancestor_cat_id_2 = 44;
  //Lets get the current category we are in
  $cur_cat_id = get_cat_id( single_cat_title(&quot;&quot;,false) );
  $is_ancestor_1 = false;  
  $is_ancestor_2 = false;  
//Check if we are in the ancestor category
  $is_ancestor_1 = is_ancestor_cat($ancestor_cat_id_1, $cur_cat_id);
  $is_ancestor_2 = is_ancestor_cat($ancestor_cat_id_2, $cur_cat_id);
  //If it is an ancestor, use a specific template
  if($is_ancestor_1){
   include(TEMPLATEPATH.&#039;/category-43.php&#039;);
  }
  else if($is_ancestor_2){
     include(TEMPLATEPATH.&#039;/category-44.php&#039;);
  }
  //Use the default template
  else{
   include(TEMPLATEPATH.&#039;/category-default.php&#039;);
  }

}&lt;/code&gt;</description>
		<content:encoded><![CDATA[<p>Yes just run the code twice, something like this:<br />
<code>if(is_category()){<br />
  $ancestor_cat_id_1 = 43;<br />
  $ancestor_cat_id_2 = 44;<br />
  //Lets get the current category we are in<br />
  $cur_cat_id = get_cat_id( single_cat_title(&quot;&quot;,false) );<br />
  $is_ancestor_1 = false;<br />
  $is_ancestor_2 = false;<br />
//Check if we are in the ancestor category<br />
  $is_ancestor_1 = is_ancestor_cat($ancestor_cat_id_1, $cur_cat_id);<br />
  $is_ancestor_2 = is_ancestor_cat($ancestor_cat_id_2, $cur_cat_id);<br />
  //If it is an ancestor, use a specific template<br />
  if($is_ancestor_1){<br />
   include(TEMPLATEPATH.&#39;/category-43.php&#39;);<br />
  }<br />
  else if($is_ancestor_2){<br />
     include(TEMPLATEPATH.&#39;/category-44.php&#39;);<br />
  }<br />
  //Use the default template<br />
  else{<br />
   include(TEMPLATEPATH.&#39;/category-default.php&#39;);<br />
  }</p>
<p>}</code></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Daniel</title>
		<link>http://www.mummey.org/2009/03/finding-a-category-ancestor-descendant-wp-templates/comment-page-1/#comment-125</link>
		<dc:creator>Daniel</dc:creator>
		<pubDate>Mon, 30 Mar 2009 19:53:48 +0000</pubDate>
		<guid isPermaLink="false">http://www.mummey.org/?p=365#comment-125</guid>
		<description>Good work Adrian! Just one question; is it possible to modify this function to allow more than one ancestor_cat_id? Per example: if is ancestor of cat ID 43, include one file, if is ancestor of cat ID 80 include another file. Sorry I&#039;m not a coder :-) Thanks!!</description>
		<content:encoded><![CDATA[<p>Good work Adrian! Just one question; is it possible to modify this function to allow more than one ancestor_cat_id? Per example: if is ancestor of cat ID 43, include one file, if is ancestor of cat ID 80 include another file. Sorry I&#8217;m not a coder <img src='http://www.mummey.org/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  Thanks!!</p>
]]></content:encoded>
	</item>
</channel>
</rss>
