rendered paste body<?php
function get_page_root( $post ) {
$ancestors = $post->ancestors;
if ( is_array( $ancestors ) && count( $ancestors ) > 0 )
return end( $ancestors );
else
return $post->ID;
return 0;
}
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en-US">
<head>
<meta http-equiv="Content-Type" content="text/html charset=UTF-8" />
<title>Weird Theme</title>
<style type="text/css">
#page{
width:900px;
margin:0 auto;
}
#menu {
width:150px;
float:left;
}
#submenu {
width:150px;
float:left;
}
#content{
width:500px;
float:left;
}
.clear{ clear:both; }
</style>
</head>
<body>
<div id="page">
<div id="menu">
<?php
wp_list_pages( 'title_li=&depth=1' );
?>
</div>
<?php
if( is_page() ) {
print "\n\t\t" . '<div id="submenu">';
wp_list_pages( 'title_li=&child_of=' . get_page_root( $post ) );
print "\n\t\t" . '</div>';
}
?>
<div id="content">
<?php
if ( have_posts() ) {
while ( have_posts() ) {
the_post();
the_title( '<h1>', '</h1>' );
the_content();
}
comments_template();
}
else {
print '<h1>Not Found</h1><p>Sorry, but the resuorce you are looking for could not be found.</p>';
}
?>
</div>
<div class="clear"></div>
</div>
</body>
</html>