<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Blog Theme Machine &#187; Wordpress Hacks</title>
	<atom:link href="http://blogthememachine.com/category/wordpress/wordpress-hacks/feed/" rel="self" type="application/rss+xml" />
	<link>http://blogthememachine.com</link>
	<description>Custom Blog Designs by a Tennessee Web Design Company</description>
	<lastBuildDate>Fri, 29 Jan 2010 09:05:08 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Listing Wordpress Pages Multiple Levels Deep</title>
		<link>http://blogthememachine.com/listing-wordpress-pages-multiple-levels-deep/</link>
		<comments>http://blogthememachine.com/listing-wordpress-pages-multiple-levels-deep/#comments</comments>
		<pubDate>Thu, 18 Sep 2008 05:09:33 +0000</pubDate>
		<dc:creator>Mike Smith</dc:creator>
				<category><![CDATA[Wordpress Hacks]]></category>

		<guid isPermaLink="false">http://blogthememachine.com/?p=150</guid>
		<description><![CDATA[
I was recently working on a client project that required the ability to show a &#8220;sub menu&#8221; when you&#8217;re on a specific page and also the sub-sub page for the first sub page. So for instance I have the following:

HOME PAGE
HOME PAGE &#8211; FIRST PAGE
HOME PAGE &#8211; FIRST PAGE &#8211; SECOND PAGE

Now, I needed to [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://blogthememachine.com/listing-wordpress-pages-multiple-levels-deep"><img class="alignnone size-full wp-image-151" title="btm_multiplepages" src="http://blogthememachine.com/wp-content/uploads/2008/09/btm_multiplepages.jpg" alt="" /></a></p>
<p>I was recently working on a client project that required the ability to show a &#8220;sub menu&#8221; when you&#8217;re on a specific page and also the sub-sub page for the first sub page. So for instance I have the following:</p>
<ol>
<li>HOME PAGE</li>
<li>HOME PAGE &#8211; FIRST PAGE</li>
<li>HOME PAGE &#8211; FIRST PAGE &#8211; SECOND PAGE</li>
</ol>
<p>Now, I needed to be able to call a list for the FIRST PAGE to showcase any of the SECOND PAGE links, but also pull a list on the SECOND PAGE for anything under that one (ie: THIRD PAGE). I found a quick solution to show sub pages by using a simple piece of php code, but that wouldn&#8217;t work for a SUB &#8211; SUB PAGE, thus, after some digging and piecing together, the code below works like a charm.</p>
<blockquote><p>&lt;?php<br />
global $post;</p>
<p>if ( $post-&gt;post_parent )<br />
$parent = wp_list_pages(&#8221;title_li=&amp;echo=0&amp;hierarchical=0&amp;include=&#8221; . $post-&gt;post_parent); else</p>
<p>$thispage = wp_list_pages(&#8221;title_li=&amp;echo=0&amp;hierarchical=0&amp;include=&#8221; . $post-&gt;ID);<br />
$children = wp_list_pages(&#8221;title_li=&amp;echo=0&amp;depth=1&amp;sort_column=menu_order&amp;child_of=&#8221; . $post-&gt;ID);</p>
<p>if ($children) { ?&gt;<br />
&lt;div class=&#8221;sidebox&#8221;&gt;<br />
&lt;img src=&#8221;&lt;?php bloginfo(&#8217;stylesheet_directory&#8217;); ?&gt;/images/side_subnavigation.jpg&#8221; alt=&#8221;Navigation&#8221; /&gt;<br />
&lt;ul&gt;<br />
&lt;?php echo $children; ?&gt;<br />
&lt;/ul&gt;<br />
&lt;/div&gt;<br />
&lt;? } ?&gt;</p></blockquote>
<p>Now you&#8217;ll notice that I added a &lt;div&gt; around my ul list because thats what my design called for but you can remove the div, change it to fit your needs, or style the ul by adding a class to it, ect. That is a whole other subject, but for now, at least I have a working piece of php code that will display a SUB navigation and also a SUB SUB navigation when needed on the site.</p>
<p><em><strong>*Please note due to the way that the blockquotes work in wordpress, the above code will need the &#8221; replaced. Just highlight each &#8221; and retype it out yourself once you paste the code into whatever editor you&#8217;re using.</strong></em></p>
<img src="http://blogthememachine.com/?ak_action=api_record_view&id=150&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://blogthememachine.com/listing-wordpress-pages-multiple-levels-deep/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>
