<?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 WordPress function to check page parent</title>
	<atom:link href="http://www.mattvarone.com/wordpress/wordpress-check-page-parent/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.mattvarone.com/wordpress/wordpress-check-page-parent/</link>
	<description>Creative Developer</description>
	<lastBuildDate>Tue, 20 Jul 2010 05:52:54 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
	<item>
		<title>By: Guillermo</title>
		<link>http://www.mattvarone.com/wordpress/wordpress-check-page-parent/#comment-2282</link>
		<dc:creator>Guillermo</dc:creator>
		<pubDate>Mon, 22 Mar 2010 18:58:08 +0000</pubDate>
		<guid isPermaLink="false">http://www.mattvarone.com/?p=694#comment-2282</guid>
		<description>There is a more efficient way, yo have only to check the post_parent variable:
&lt;code&gt;
function is_subpage($the_id){
	global $post;
	if ($post-&gt;post_parent == &#039;20&#039;) {
		return true;
	} else {
		return false;
	}
}
&lt;/code&gt;</description>
		<content:encoded><![CDATA[<p>There is a more efficient way, yo have only to check the post_parent variable:<br />
<code><br />
function is_subpage($the_id){<br />
	global $post;<br />
	if ($post-&gt;post_parent == '20') {<br />
		return true;<br />
	} else {<br />
		return false;<br />
	}<br />
}<br />
</code></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: is_subpage() and is_descendant() - WordPress Tavern Forum</title>
		<link>http://www.mattvarone.com/wordpress/wordpress-check-page-parent/#comment-1924</link>
		<dc:creator>is_subpage() and is_descendant() - WordPress Tavern Forum</dc:creator>
		<pubDate>Fri, 05 Mar 2010 14:01:54 +0000</pubDate>
		<guid isPermaLink="false">http://www.mattvarone.com/?p=694#comment-1924</guid>
		<description>[...] function in my theme&#039;s functions.php file. I can&#039;t remember where I found the one I use, but I stumbled upon one that&#039;s even better:   PHP Code:    [...]</description>
		<content:encoded><![CDATA[<p>[...] function in my theme&#39;s functions.php file. I can&#39;t remember where I found the one I use, but I stumbled upon one that&#39;s even better:   PHP Code:    [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jonathan Wold</title>
		<link>http://www.mattvarone.com/wordpress/wordpress-check-page-parent/#comment-1535</link>
		<dc:creator>Jonathan Wold</dc:creator>
		<pubDate>Tue, 07 Jul 2009 14:35:13 +0000</pubDate>
		<guid isPermaLink="false">http://www.mattvarone.com/?p=694#comment-1535</guid>
		<description>Matt,

Very helpful function. I added a reference to it from the WordPress Codex.

Quick question - Could you write an update that would accommodate for the &quot;slug name&quot; as well as the ID? This is especially useful when building a theme on a dev server to be transferred live where IDs may change, but slugs stay the same.

Thank you, sir!</description>
		<content:encoded><![CDATA[<p>Matt,</p>
<p>Very helpful function. I added a reference to it from the WordPress Codex.</p>
<p>Quick question &#8211; Could you write an update that would accommodate for the &#8220;slug name&#8221; as well as the ID? This is especially useful when building a theme on a dev server to be transferred live where IDs may change, but slugs stay the same.</p>
<p>Thank you, sir!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Matt</title>
		<link>http://www.mattvarone.com/wordpress/wordpress-check-page-parent/#comment-1476</link>
		<dc:creator>Matt</dc:creator>
		<pubDate>Wed, 27 May 2009 11:44:28 +0000</pubDate>
		<guid isPermaLink="false">http://www.mattvarone.com/?p=694#comment-1476</guid>
		<description>Hi Robert, thanks for the comment. I understand your problem, what you need is to pass the ID also of that one top page you are checking. For example if you Home page ID is 3 and your About page ID is 5 it would be: 

“is_page(’home’) &#124;&#124; is_subpage(4)”
“is_page(’about’) &#124;&#124; is_subpage(5)”

Otherwise it wil show you the subpages sidebar each time you are on a subpage no matter which parent page they have. Hope that helps!</description>
		<content:encoded><![CDATA[<p>Hi Robert, thanks for the comment. I understand your problem, what you need is to pass the ID also of that one top page you are checking. For example if you Home page ID is 3 and your About page ID is 5 it would be: </p>
<p>“is_page(’home’) || is_subpage(4)”<br />
“is_page(’about’) || is_subpage(5)”</p>
<p>Otherwise it wil show you the subpages sidebar each time you are on a subpage no matter which parent page they have. Hope that helps!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Robert Neuschul</title>
		<link>http://www.mattvarone.com/wordpress/wordpress-check-page-parent/#comment-1474</link>
		<dc:creator>Robert Neuschul</dc:creator>
		<pubDate>Tue, 26 May 2009 15:17:37 +0000</pubDate>
		<guid isPermaLink="false">http://www.mattvarone.com/?p=694#comment-1474</guid>
		<description>Hi Matt

I&#039;m clearly doing something wrong, but I can&#039;t figure this out.

Have added the is_subpage() function to my template theme, functions.php and am using widget logic control in an attempt to build context sensitive subpage menus in the sidebar.

Thus if I have two top level menu items called &quot;home&quot; and &quot;about&quot; I would want to show different sidebar menus in each. The conventional widget logic for the sidebar on the home page would then be &quot;is_page(&#039;home&#039;) &#124;&#124; is_subpage()&quot; and on the about page would be &quot;is_page(&#039;about&#039;) &#124;&#124; is_subpage()&quot; - and each instance would then show different subpages in different locations.

What actually happens is that the top level menu items show the correct context sensitive menu, but any sub pages show ALL submenus - both those from &quot;home&quot; and &quot;about&quot;. 

I really don&#039;t want to have to &quot;name&quot; each of the subpage instances explicitly in each usage since that renders it pointless having/using the subpage function in the first place. 

Not being a programmer this may be the wrong description, but it feels as if your function is creating only one global instance of the subpage array and not clearing that array when a user moves to a different page/subpage.

Hope this description makes sense. Any help or pointers would be most useful.</description>
		<content:encoded><![CDATA[<p>Hi Matt</p>
<p>I&#8217;m clearly doing something wrong, but I can&#8217;t figure this out.</p>
<p>Have added the is_subpage() function to my template theme, functions.php and am using widget logic control in an attempt to build context sensitive subpage menus in the sidebar.</p>
<p>Thus if I have two top level menu items called &#8220;home&#8221; and &#8220;about&#8221; I would want to show different sidebar menus in each. The conventional widget logic for the sidebar on the home page would then be &#8220;is_page(&#8216;home&#8217;) || is_subpage()&#8221; and on the about page would be &#8220;is_page(&#8216;about&#8217;) || is_subpage()&#8221; &#8211; and each instance would then show different subpages in different locations.</p>
<p>What actually happens is that the top level menu items show the correct context sensitive menu, but any sub pages show ALL submenus &#8211; both those from &#8220;home&#8221; and &#8220;about&#8221;. </p>
<p>I really don&#8217;t want to have to &#8220;name&#8221; each of the subpage instances explicitly in each usage since that renders it pointless having/using the subpage function in the first place. </p>
<p>Not being a programmer this may be the wrong description, but it feels as if your function is creating only one global instance of the subpage array and not clearing that array when a user moves to a different page/subpage.</p>
<p>Hope this description makes sense. Any help or pointers would be most useful.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: WordPress. Una funzione per controllare la pagina madre &#8212; Studio404 Web Agency</title>
		<link>http://www.mattvarone.com/wordpress/wordpress-check-page-parent/#comment-1357</link>
		<dc:creator>WordPress. Una funzione per controllare la pagina madre &#8212; Studio404 Web Agency</dc:creator>
		<pubDate>Tue, 05 May 2009 12:58:20 +0000</pubDate>
		<guid isPermaLink="false">http://www.mattvarone.com/?p=694#comment-1357</guid>
		<description>[...] Articolo originale: WordPress Check Page Parent custom function [...]</description>
		<content:encoded><![CDATA[<p>[...] Articolo originale: WordPress Check Page Parent custom function [...]</p>
]]></content:encoded>
	</item>
</channel>
</rss>
