<?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: Is Category or Subcategory WP Function</title>
	<atom:link href="http://valendesigns.com/wordpress/is-category-or-subcategory-wp-function/feed/" rel="self" type="application/rss+xml" />
	<link>http://valendesigns.com/wordpress/is-category-or-subcategory-wp-function/</link>
	<description>Build Market Empower</description>
	<lastBuildDate>Tue, 31 Aug 2010 15:03:12 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Andy Gongea</title>
		<link>http://valendesigns.com/wordpress/is-category-or-subcategory-wp-function/#comment-757</link>
		<dc:creator>Andy Gongea</dc:creator>
		<pubDate>Mon, 26 Jul 2010 10:05:13 +0000</pubDate>
		<guid isPermaLink="false">http://valendesigns.com/?p=508#comment-757</guid>
		<description>Hi Derek,

Thanks for providing this solution. 
You should submit it to WP because it is a valuable and quite used function. For me, you saved the day !!!

Kudos!</description>
		<content:encoded><![CDATA[<p>Hi Derek,</p>
<p>Thanks for providing this solution.<br />
You should submit it to WP because it is a valuable and quite used function. For me, you saved the day !!!</p>
<p>Kudos!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Codeschnippsel zu WordPress Kategorien &#124; SohbeTCix.NeT &#124; Chat Sohbet Muhabbet Odaları</title>
		<link>http://valendesigns.com/wordpress/is-category-or-subcategory-wp-function/#comment-681</link>
		<dc:creator>Codeschnippsel zu WordPress Kategorien &#124; SohbeTCix.NeT &#124; Chat Sohbet Muhabbet Odaları</dc:creator>
		<pubDate>Mon, 07 Jun 2010 08:20:26 +0000</pubDate>
		<guid isPermaLink="false">http://valendesigns.com/?p=508#comment-681</guid>
		<description>[...] zweite Sache brauchte ich nicht erstellen, die habe ich bei valen gefunden &#8211; klein aber fein. Sie gibt zurück, ob man sich in einer untergeordneten- oder der [...]</description>
		<content:encoded><![CDATA[<p>[...] zweite Sache brauchte ich nicht erstellen, die habe ich bei valen gefunden &#8211; klein aber fein. Sie gibt zurück, ob man sich in einer untergeordneten- oder der [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: daniel</title>
		<link>http://valendesigns.com/wordpress/is-category-or-subcategory-wp-function/#comment-651</link>
		<dc:creator>daniel</dc:creator>
		<pubDate>Sun, 11 Apr 2010 16:57:52 +0000</pubDate>
		<guid isPermaLink="false">http://valendesigns.com/?p=508#comment-651</guid>
		<description>hi 

does it work also with category-slugs?

thank you</description>
		<content:encoded><![CDATA[<p>hi </p>
<p>does it work also with category-slugs?</p>
<p>thank you</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Derek Herman</title>
		<link>http://valendesigns.com/wordpress/is-category-or-subcategory-wp-function/#comment-614</link>
		<dc:creator>Derek Herman</dc:creator>
		<pubDate>Mon, 16 Nov 2009 22:18:10 +0000</pubDate>
		<guid isPermaLink="false">http://valendesigns.com/?p=508#comment-614</guid>
		<description>To clarify, the function says return true if parent OR child. So, it doesn&#039;t matter if you have both of them checked off or not.</description>
		<content:encoded><![CDATA[<p>To clarify, the function says return true if parent OR child. So, it doesn&#8217;t matter if you have both of them checked off or not.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Carlo (Uber WP Newbie)</title>
		<link>http://valendesigns.com/wordpress/is-category-or-subcategory-wp-function/#comment-613</link>
		<dc:creator>Carlo (Uber WP Newbie)</dc:creator>
		<pubDate>Mon, 16 Nov 2009 18:20:04 +0000</pubDate>
		<guid isPermaLink="false">http://valendesigns.com/?p=508#comment-613</guid>
		<description>HI Derek,

I think Trau&#039;s problem (emphasis on i*I think*, I probably should try it first) might have to do with the categories the current post was assigned to. What I mean is.. when that post was added, it could have been assigned both the parent and child category in the Categories box ( via checking both the parent and child boxes)

Unless that&#039;s the proper way of doing that?

It can&#039;t be, right? However, for example, when if setup my permalink structure as so:

/%category%/%postname%/

I end up with the permalink of my child category posts  showing only the parent category while /%category%/ is supposed generate the nested directory for the sub category.

-C</description>
		<content:encoded><![CDATA[<p>HI Derek,</p>
<p>I think Trau&#8217;s problem (emphasis on i*I think*, I probably should try it first) might have to do with the categories the current post was assigned to. What I mean is.. when that post was added, it could have been assigned both the parent and child category in the Categories box ( via checking both the parent and child boxes)</p>
<p>Unless that&#8217;s the proper way of doing that?</p>
<p>It can&#8217;t be, right? However, for example, when if setup my permalink structure as so:</p>
<p>/%category%/%postname%/</p>
<p>I end up with the permalink of my child category posts  showing only the parent category while /%category%/ is supposed generate the nested directory for the sub category.</p>
<p>-C</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Derek Herman</title>
		<link>http://valendesigns.com/wordpress/is-category-or-subcategory-wp-function/#comment-610</link>
		<dc:creator>Derek Herman</dc:creator>
		<pubDate>Fri, 13 Nov 2009 11:17:47 +0000</pubDate>
		<guid isPermaLink="false">http://valendesigns.com/?p=508#comment-610</guid>
		<description>Trau, for starters you should be putting the function in your functions.php and not in your theme file.

Second, I use this function on almost every site I&#039;ve ever built and it has always worked fine. I&#039;m not sure why you are having difficulty but there is no reason I can think of that you would need to edit the original function. 

I&#039;m glad you got it to work anyhow.</description>
		<content:encoded><![CDATA[<p>Trau, for starters you should be putting the function in your functions.php and not in your theme file.</p>
<p>Second, I use this function on almost every site I&#8217;ve ever built and it has always worked fine. I&#8217;m not sure why you are having difficulty but there is no reason I can think of that you would need to edit the original function. </p>
<p>I&#8217;m glad you got it to work anyhow.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: trau</title>
		<link>http://valendesigns.com/wordpress/is-category-or-subcategory-wp-function/#comment-609</link>
		<dc:creator>trau</dc:creator>
		<pubDate>Fri, 13 Nov 2009 10:59:21 +0000</pubDate>
		<guid isPermaLink="false">http://valendesigns.com/?p=508#comment-609</guid>
		<description>ok i know! 
i have add code:
$this_category = get_category($cat);

and modifie the function &quot;is_category_or_sub&quot; with parameter $this_category and this work!!
thx a lot!
:)
good blog
regard
erwin</description>
		<content:encoded><![CDATA[<p>ok i know!<br />
i have add code:<br />
$this_category = get_category($cat);</p>
<p>and modifie the function &#8220;is_category_or_sub&#8221; with parameter $this_category and this work!!<br />
thx a lot!<br />
:)<br />
good blog<br />
regard<br />
erwin</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: trau</title>
		<link>http://valendesigns.com/wordpress/is-category-or-subcategory-wp-function/#comment-608</link>
		<dc:creator>trau</dc:creator>
		<pubDate>Fri, 13 Nov 2009 10:52:30 +0000</pubDate>
		<guid isPermaLink="false">http://valendesigns.com/?p=508#comment-608</guid>
		<description>hi!
sorry i don&#039;t very good in php but your code don&#039;t work good on my site.
i have a category and a subcategory and with your code i can see if i am in category or subcategory true?

i have put this code:
// If is category or subcategory of $cat_id
if (!function_exists(&#039;is_category_or_sub&#039;)) {
	function is_category_or_sub($cat_id = 0) {
	    foreach (get_the_category() as $cat) {
	    	if ($cat_id == $cat-&gt;cat_ID &#124;&#124; cat_is_ancestor_of($cat_id, $cat)) return true;
	    }
	    return false;
	}
}

if (is_category_or_sub(1)) { 
		echo &quot;DISPLAY 1&quot;;
	} else {
		echo &quot;DISPLAY 2&quot;;
	}

in page archive.php

but i see string &quot;DISPLAY 2&quot; in booth category and subcategory why?
i have put this code before  in archive page.
Can you help me please?where i wrong?
regard erwin

ps sorry my bad english :P</description>
		<content:encoded><![CDATA[<p>hi!<br />
sorry i don&#8217;t very good in php but your code don&#8217;t work good on my site.<br />
i have a category and a subcategory and with your code i can see if i am in category or subcategory true?</p>
<p>i have put this code:<br />
// If is category or subcategory of $cat_id<br />
if (!function_exists(&#8216;is_category_or_sub&#8217;)) {<br />
	function is_category_or_sub($cat_id = 0) {<br />
	    foreach (get_the_category() as $cat) {<br />
	    	if ($cat_id == $cat-&gt;cat_ID || cat_is_ancestor_of($cat_id, $cat)) return true;<br />
	    }<br />
	    return false;<br />
	}<br />
}</p>
<p>if (is_category_or_sub(1)) {<br />
		echo &#8220;DISPLAY 1&#8243;;<br />
	} else {<br />
		echo &#8220;DISPLAY 2&#8243;;<br />
	}</p>
<p>in page archive.php</p>
<p>but i see string &#8220;DISPLAY 2&#8243; in booth category and subcategory why?<br />
i have put this code before  in archive page.<br />
Can you help me please?where i wrong?<br />
regard erwin</p>
<p>ps sorry my bad english :P</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Andy</title>
		<link>http://valendesigns.com/wordpress/is-category-or-subcategory-wp-function/#comment-300</link>
		<dc:creator>Andy</dc:creator>
		<pubDate>Fri, 26 Jun 2009 01:05:35 +0000</pubDate>
		<guid isPermaLink="false">http://valendesigns.com/?p=508#comment-300</guid>
		<description>Thanks heaps exactly what I was looking for!</description>
		<content:encoded><![CDATA[<p>Thanks heaps exactly what I was looking for!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Derek Herman</title>
		<link>http://valendesigns.com/wordpress/is-category-or-subcategory-wp-function/#comment-289</link>
		<dc:creator>Derek Herman</dc:creator>
		<pubDate>Fri, 19 Jun 2009 09:21:00 +0000</pubDate>
		<guid isPermaLink="false">http://valendesigns.com/?p=508#comment-289</guid>
		<description>Sure you can donate using the button I added above. Glad it was of use to you!</description>
		<content:encoded><![CDATA[<p>Sure you can donate using the button I added above. Glad it was of use to you!</p>
]]></content:encoded>
	</item>
</channel>
</rss>
