<?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: Added Plugin to WordPress Directory</title>
	<atom:link href="http://valendesigns.com/news/added-plugin-to-wordpress-directory/feed/" rel="self" type="application/rss+xml" />
	<link>http://valendesigns.com/news/added-plugin-to-wordpress-directory/</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: Derek Herman</title>
		<link>http://valendesigns.com/news/added-plugin-to-wordpress-directory/#comment-698</link>
		<dc:creator>Derek Herman</dc:creator>
		<pubDate>Wed, 09 Jun 2010 17:18:56 +0000</pubDate>
		<guid isPermaLink="false">http://valendesigns.com/?p=518#comment-698</guid>
		<description>Glad to help, I needed to update that plugin anyhow. Thanks for the donation, as well.</description>
		<content:encoded><![CDATA[<p>Glad to help, I needed to update that plugin anyhow. Thanks for the donation, as well.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: David</title>
		<link>http://valendesigns.com/news/added-plugin-to-wordpress-directory/#comment-697</link>
		<dc:creator>David</dc:creator>
		<pubDate>Wed, 09 Jun 2010 17:14:17 +0000</pubDate>
		<guid isPermaLink="false">http://valendesigns.com/?p=518#comment-697</guid>
		<description>donation on the way - keep the awesomeness flowing ;)</description>
		<content:encoded><![CDATA[<p>donation on the way &#8211; keep the awesomeness flowing ;)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: David</title>
		<link>http://valendesigns.com/news/added-plugin-to-wordpress-directory/#comment-696</link>
		<dc:creator>David</dc:creator>
		<pubDate>Wed, 09 Jun 2010 17:08:45 +0000</pubDate>
		<guid isPermaLink="false">http://valendesigns.com/?p=518#comment-696</guid>
		<description>Yeah! That was it, works perfectly now. Thanks again.</description>
		<content:encoded><![CDATA[<p>Yeah! That was it, works perfectly now. Thanks again.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Derek Herman</title>
		<link>http://valendesigns.com/news/added-plugin-to-wordpress-directory/#comment-695</link>
		<dc:creator>Derek Herman</dc:creator>
		<pubDate>Wed, 09 Jun 2010 16:20:19 +0000</pubDate>
		<guid isPermaLink="false">http://valendesigns.com/?p=518#comment-695</guid>
		<description>Updated the plugin in the WordPress directory.</description>
		<content:encoded><![CDATA[<p>Updated the plugin in the WordPress directory.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Derek Herman</title>
		<link>http://valendesigns.com/news/added-plugin-to-wordpress-directory/#comment-694</link>
		<dc:creator>Derek Herman</dc:creator>
		<pubDate>Wed, 09 Jun 2010 16:04:22 +0000</pubDate>
		<guid isPermaLink="false">http://valendesigns.com/?p=518#comment-694</guid>
		<description>Change to this below, I ran into the same issue, and it&#039;s because the page you&#039;re testing doesn&#039;t have any ancestors.

// Recursive search through page hierarchy
if (is_page($page) &#124;&#124; (is_array($post-&gt;ancestors) &amp;&amp; in_array($page, $post-&gt;ancestors) )) {</description>
		<content:encoded><![CDATA[<p>Change to this below, I ran into the same issue, and it&#8217;s because the page you&#8217;re testing doesn&#8217;t have any ancestors.</p>
<p>// Recursive search through page hierarchy<br />
if (is_page($page) || (is_array($post-&gt;ancestors) &amp;&amp; in_array($page, $post-&gt;ancestors) )) {</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: David</title>
		<link>http://valendesigns.com/news/added-plugin-to-wordpress-directory/#comment-693</link>
		<dc:creator>David</dc:creator>
		<pubDate>Wed, 09 Jun 2010 15:57:44 +0000</pubDate>
		<guid isPermaLink="false">http://valendesigns.com/?p=518#comment-693</guid>
		<description>Hi Derek - thanks for this and the related category function (is_category_or_sub)... both huge help for me as I build out a theme.

I am having the same problem as a few other commenters posted above - getting the following error message:

Warning: in_array() [function.in-array]: Wrong datatype for second argument in /home/username/example.com/wp-content/themes/theme-name/functions.php  on line 120

Line 120 is from your function (the latest version you&#039;ve commented above... though I get the same error with the previous version as well):

Line 120 --&gt;  if (is_page($page) &#124;&#124; in_array($page, $post-&gt;ancestors)) {

I am using the function call in my nav menu, pretty much as you would expect. Any idea what about that &quot;in_array&quot; call is off?

Perhaps the plugin version has been corrected? I&#039;ll try that. Otherwise, I suppose I&#039;ll use the older / original version of this function, is_page_or_sub. But I do hope you can fix the function.php version, as I prefer that method rather than using plugins.

Thanks!</description>
		<content:encoded><![CDATA[<p>Hi Derek &#8211; thanks for this and the related category function (is_category_or_sub)&#8230; both huge help for me as I build out a theme.</p>
<p>I am having the same problem as a few other commenters posted above &#8211; getting the following error message:</p>
<p>Warning: in_array() [function.in-array]: Wrong datatype for second argument in /home/username/example.com/wp-content/themes/theme-name/functions.php  on line 120</p>
<p>Line 120 is from your function (the latest version you&#8217;ve commented above&#8230; though I get the same error with the previous version as well):</p>
<p>Line 120 &#8211;&gt;  if (is_page($page) || in_array($page, $post-&gt;ancestors)) {</p>
<p>I am using the function call in my nav menu, pretty much as you would expect. Any idea what about that &#8220;in_array&#8221; call is off?</p>
<p>Perhaps the plugin version has been corrected? I&#8217;ll try that. Otherwise, I suppose I&#8217;ll use the older / original version of this function, is_page_or_sub. But I do hope you can fix the function.php version, as I prefer that method rather than using plugins.</p>
<p>Thanks!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Derek Herman</title>
		<link>http://valendesigns.com/news/added-plugin-to-wordpress-directory/#comment-658</link>
		<dc:creator>Derek Herman</dc:creator>
		<pubDate>Tue, 11 May 2010 14:54:40 +0000</pubDate>
		<guid isPermaLink="false">http://valendesigns.com/?p=518#comment-658</guid>
		<description>try:

function is_page_or_ancestor($page = &#039;&#039;) 
{ 
&#160;&#160;global $post, $wpdb;

&#160;&#160;// If is not numeric get page ID
&#160;&#160;if (!is_numeric($page)) {
&#160;&#160;&#160;&#160;$page = $wpdb-&gt;get_var(&quot;SELECT ID FROM $wpdb-&gt;posts WHERE post_name = &#039;&quot;.$page.&quot;&#039; AND post_type = &#039;page&#039;&quot;);
&#160;&#160;}

&#160;&#160;// Recursive search through page hierarchy
&#160;&#160;if (is_page($page) &#124;&#124; in_array($page, $post-&gt;ancestors)) {
&#160;&#160;&#160;&#160;return true;
&#160;&#160;}
&#160;&#160;return false;
}</description>
		<content:encoded><![CDATA[<p>try:</p>
<p>function is_page_or_ancestor($page = &#8221;)<br />
{<br />
&nbsp;&nbsp;global $post, $wpdb;</p>
<p>&nbsp;&nbsp;// If is not numeric get page ID<br />
&nbsp;&nbsp;if (!is_numeric($page)) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;$page = $wpdb-&gt;get_var(&#8220;SELECT ID FROM $wpdb-&gt;posts WHERE post_name = &#8216;&#8221;.$page.&#8221;&#8216; AND post_type = &#8216;page&#8217;&#8221;);<br />
&nbsp;&nbsp;}</p>
<p>&nbsp;&nbsp;// Recursive search through page hierarchy<br />
&nbsp;&nbsp;if (is_page($page) || in_array($page, $post-&gt;ancestors)) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;return true;<br />
&nbsp;&nbsp;}<br />
&nbsp;&nbsp;return false;<br />
}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Trevor Robertson</title>
		<link>http://valendesigns.com/news/added-plugin-to-wordpress-directory/#comment-657</link>
		<dc:creator>Trevor Robertson</dc:creator>
		<pubDate>Tue, 11 May 2010 06:07:26 +0000</pubDate>
		<guid isPermaLink="false">http://valendesigns.com/?p=518#comment-657</guid>
		<description>Shoot, actually no you fix does not work for me.  The error is gone but so is the current page class. Darn.</description>
		<content:encoded><![CDATA[<p>Shoot, actually no you fix does not work for me.  The error is gone but so is the current page class. Darn.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Trevor Robertson</title>
		<link>http://valendesigns.com/news/added-plugin-to-wordpress-directory/#comment-656</link>
		<dc:creator>Trevor Robertson</dc:creator>
		<pubDate>Tue, 11 May 2010 06:05:06 +0000</pubDate>
		<guid isPermaLink="false">http://valendesigns.com/?p=518#comment-656</guid>
		<description>Hi Derek, 

I had the same error as Mike, using the same configuration except WP 2.9.2 and your revised code works perfectly! Hopefully you can update the plugin soon in the WP repository because this is essential code for anyone hard coding their navigation. Thanks for making this, saved my bacon for sure!

Trevor</description>
		<content:encoded><![CDATA[<p>Hi Derek, </p>
<p>I had the same error as Mike, using the same configuration except WP 2.9.2 and your revised code works perfectly! Hopefully you can update the plugin soon in the WP repository because this is essential code for anyone hard coding their navigation. Thanks for making this, saved my bacon for sure!</p>
<p>Trevor</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Derek Herman</title>
		<link>http://valendesigns.com/news/added-plugin-to-wordpress-directory/#comment-643</link>
		<dc:creator>Derek Herman</dc:creator>
		<pubDate>Tue, 16 Feb 2010 18:35:13 +0000</pubDate>
		<guid isPermaLink="false">http://valendesigns.com/?p=518#comment-643</guid>
		<description>Try this. It&#039;s not tested, let me know if it works though.

if (!function_exists(&#039;is_page_or_ancestor&#039;)) {
&#160;&#160;function is_page_or_ancestor($page = &#039;&#039;) { 
&#160;&#160;&#160;&#160;global $post, $wpdb;
 
&#160;&#160;&#160;&#160;// If is not numeric get page ID
&#160;&#160;&#160;&#160;if (!is_numeric($page)) {
&#160;&#160;&#160;&#160;&#160;&#160;$page = $wpdb-&gt;get_var(&quot;SELECT ID FROM $wpdb-&gt;posts WHERE post_name = &#039;&quot;.$page.&quot;&#039; AND post_type = &#039;page&#039;&quot;);
&#160;&#160;&#160;&#160;}

&#160;&#160;&#160;&#160;$ancestors = get_post_ancestors($page);

&#160;&#160;&#160;&#160;// Recursive search through page hierarchy
&#160;&#160;&#160;&#160;if (is_page($page) &#124;&#124; in_array($page, $ancestors)) {
&#160;&#160;&#160;&#160;&#160;&#160;return true;
&#160;&#160;&#160;&#160;}
&#160;&#160;&#160;&#160;return false;
&#160;&#160;}
}</description>
		<content:encoded><![CDATA[<p>Try this. It&#8217;s not tested, let me know if it works though.</p>
<p>if (!function_exists(&#8216;is_page_or_ancestor&#8217;)) {<br />
&nbsp;&nbsp;function is_page_or_ancestor($page = &#8221;) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;global $post, $wpdb;</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;// If is not numeric get page ID<br />
&nbsp;&nbsp;&nbsp;&nbsp;if (!is_numeric($page)) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$page = $wpdb-&gt;get_var(&#8220;SELECT ID FROM $wpdb-&gt;posts WHERE post_name = &#8216;&#8221;.$page.&#8221;&#8216; AND post_type = &#8216;page&#8217;&#8221;);<br />
&nbsp;&nbsp;&nbsp;&nbsp;}</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;$ancestors = get_post_ancestors($page);</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;// Recursive search through page hierarchy<br />
&nbsp;&nbsp;&nbsp;&nbsp;if (is_page($page) || in_array($page, $ancestors)) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return true;<br />
&nbsp;&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;&nbsp;return false;<br />
&nbsp;&nbsp;}<br />
}</p>
]]></content:encoded>
	</item>
</channel>
</rss>
