<?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_subpage() &#8211; Custom Conditional Function</title>
	<atom:link href="http://www.mattvarone.com/wordpress/is_subpage-function/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.mattvarone.com/wordpress/is_subpage-function/</link>
	<description>Creative Developer</description>
	<lastBuildDate>Wed, 10 Mar 2010 14:01:04 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Giammarco Schisani</title>
		<link>http://www.mattvarone.com/wordpress/is_subpage-function/#comment-1900</link>
		<dc:creator>Giammarco Schisani</dc:creator>
		<pubDate>Sun, 10 Jan 2010 18:55:51 +0000</pubDate>
		<guid isPermaLink="false">http://www.mattvarone.com/?p=621#comment-1900</guid>
		<description>Exactly what I was looking for. Thanks for sharing.</description>
		<content:encoded><![CDATA[<p>Exactly what I was looking for. Thanks for sharing.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: is_subpage() WordPress Custom Function &#124; DeveloperFox</title>
		<link>http://www.mattvarone.com/wordpress/is_subpage-function/#comment-1882</link>
		<dc:creator>is_subpage() WordPress Custom Function &#124; DeveloperFox</dc:creator>
		<pubDate>Thu, 17 Dec 2009 19:59:24 +0000</pubDate>
		<guid isPermaLink="false">http://www.mattvarone.com/?p=621#comment-1882</guid>
		<description>[...] is_subpage() WordPress Custom Function &#8211; Custom conditional function for WordPress to check if the current page is a sub page. It works both inside and outside the main loop, only for 2.5 and upwards. [...]</description>
		<content:encoded><![CDATA[<p>[...] is_subpage() WordPress Custom Function &#8211; Custom conditional function for WordPress to check if the current page is a sub page. It works both inside and outside the main loop, only for 2.5 and upwards. [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rob Williams</title>
		<link>http://www.mattvarone.com/wordpress/is_subpage-function/#comment-1567</link>
		<dc:creator>Rob Williams</dc:creator>
		<pubDate>Tue, 28 Jul 2009 16:08:31 +0000</pubDate>
		<guid isPermaLink="false">http://www.mattvarone.com/?p=621#comment-1567</guid>
		<description>I made a small modification to the function to allow you to check to see if it&#039;s the child of a named page, rather than by its id.

function is_subpage( $page_name_or_id ) {
    global $post, $wpdb;
    if ( is_page() AND isset( $post-&gt;post_parent ) != 0 ) {
        $aParent = $wpdb-&gt;get_row( $wpdb-&gt;prepare( &quot;SELECT ID, POST_TITLE FROM $wpdb-&gt;posts WHERE ID = %d AND post_type = &#039;page&#039; LIMIT 1&quot;, $post-&gt;post_parent ) );   

        if ( $aParent-&gt;ID &amp;&amp; ($aParent-&gt;ID == $page_name_or_id &#124;&#124; $aParent-&gt;POST_TITLE == $page_name_or_id) ) return true; else return false;

    } else {
        return false;
    }
}

Thanks for the function, Matt!</description>
		<content:encoded><![CDATA[<p>I made a small modification to the function to allow you to check to see if it&#8217;s the child of a named page, rather than by its id.</p>
<p>function is_subpage( $page_name_or_id ) {<br />
    global $post, $wpdb;<br />
    if ( is_page() AND isset( $post-&gt;post_parent ) != 0 ) {<br />
        $aParent = $wpdb-&gt;get_row( $wpdb-&gt;prepare( &#8220;SELECT ID, POST_TITLE FROM $wpdb-&gt;posts WHERE ID = %d AND post_type = &#8216;page&#8217; LIMIT 1&#8243;, $post-&gt;post_parent ) );   </p>
<p>        if ( $aParent-&gt;ID &amp;&amp; ($aParent-&gt;ID == $page_name_or_id || $aParent-&gt;POST_TITLE == $page_name_or_id) ) return true; else return false;</p>
<p>    } else {<br />
        return false;<br />
    }<br />
}</p>
<p>Thanks for the function, Matt!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sub Page / is_subpage() WordPress Function » Matt Varone &#124; Squico</title>
		<link>http://www.mattvarone.com/wordpress/is_subpage-function/#comment-1487</link>
		<dc:creator>Sub Page / is_subpage() WordPress Function » Matt Varone &#124; Squico</dc:creator>
		<pubDate>Mon, 01 Jun 2009 19:20:22 +0000</pubDate>
		<guid isPermaLink="false">http://www.mattvarone.com/?p=621#comment-1487</guid>
		<description>[...] Go to Source [...]</description>
		<content:encoded><![CDATA[<p>[...] Go to Source [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rebecca</title>
		<link>http://www.mattvarone.com/wordpress/is_subpage-function/#comment-1365</link>
		<dc:creator>Rebecca</dc:creator>
		<pubDate>Thu, 07 May 2009 08:18:19 +0000</pubDate>
		<guid isPermaLink="false">http://www.mattvarone.com/?p=621#comment-1365</guid>
		<description>Hi,

Thanks for the code - I was wondering how I could check if I&#039;m on a grandchild (sub-sub-page) of page 10 for example. I would be so grateful for any advice. Thanks!</description>
		<content:encoded><![CDATA[<p>Hi,</p>
<p>Thanks for the code &#8211; I was wondering how I could check if I&#8217;m on a grandchild (sub-sub-page) of page 10 for example. I would be so grateful for any advice. Thanks!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Alex</title>
		<link>http://www.mattvarone.com/wordpress/is_subpage-function/#comment-1316</link>
		<dc:creator>Alex</dc:creator>
		<pubDate>Sat, 25 Apr 2009 15:26:34 +0000</pubDate>
		<guid isPermaLink="false">http://www.mattvarone.com/?p=621#comment-1316</guid>
		<description>Is there any reason not to use the post-&gt;ancestors property?

I did a similar approach and found out later that there is an array in the post objects containing all ancestors. I simply count it&#039;s size:
If it&#039;s bigger than 0 it&#039;s a subpage, bigger than 1 a subsubpage, etc.</description>
		<content:encoded><![CDATA[<p>Is there any reason not to use the post-&gt;ancestors property?</p>
<p>I did a similar approach and found out later that there is an array in the post objects containing all ancestors. I simply count it&#8217;s size:<br />
If it&#8217;s bigger than 0 it&#8217;s a subpage, bigger than 1 a subsubpage, etc.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
