<?php
/*
Template Name: Page List
*/
get_header(); ?>
					
	<?php if (have_posts()) : while (have_posts()) : the_post(); ?>		

		<div id="content-wrapper">
			
			<?php get_sidebar(); ?>
	
			<div id="main-content">	
	
				<?php if(!get_post_meta($post->ID, 'ghostpool_hide_page_title', true)) { ?><h1 class="page-title"><?php the_title(); ?></h1><?php } ?>
				
				<?php if($content = $post->post_content) { ?>
	
					<?php the_content(); ?>
			
				<?php } else { ?>
		
					<?php
					$children = wp_list_pages('depth=1&title_li=&child_of='.$post->ID.'&echo=0');
					if ($children) { ?>
					<ul>
						<?php echo $children; ?>
					</ul>
					<?php } ?>		
	
				<?php } ?>
	
			</div>
			
		</div>
	
	<?php endwhile; endif; ?>
			
<?php get_footer(); ?>