<ul>
<?php

$pages = get_pages('sort_column=post_date&title_li=&child_of=35&echo=0'');

$count = 0;

foreach($pages as $page) {
	
	$content = $page->post_content;

	if(!$content) { continue; }
	if($count >= 2) { break; }

$count++;
$content = apply_filters('the_content', $content);
?>
<li class="page_item"><a href="<?php echo get_page_link($page->ID) ?>"><?php echo get_post_meta($page->ID,'case_study_category',true); ?>
<span class="corpname"><?php echo get_post_meta($page->ID,'case_study_client_name',true); ?></span></a></li>
<?php
}
?>
</ul>



<?php
  $children = wp_list_pages('sort_column=post_date&title_li=&child_of=35&echo=0');
  if ($children) { ?>
  <ul>
  <?php echo $children; ?>
  </ul>
  <?php } ?>

<ul>
<?php

$pages = get_pages('title_li=&child_of=35&sort_column=post_date&sort_order=desc&echo=0');

$count = 0;

foreach($pages as $page) {
	
	$content = $page->post_content;

	if(!$content) { continue; }
	if($count >= 2) { break; }

$count++;
$content = apply_filters('the_content', $content);

>
<li class="page_item"><a href="<?php echo get_page_link($page->ID) ?>"><?php echo get_post_meta($page->ID,'case_study_category',true); ?>
<span class="corpname"><?php echo get_post_meta($page->ID,'case_study_client_name',true); ?></span></a></li>

<?php }  ?>

</ul>





<div id="sidebar-left">
<ul>
<li id="parent-page">About</li>
<?php
if($post->post_parent) {
	$pages = get_pages('title_li=&child_of='.$post->post_parent.'&sort_column=post_date&sort_order=desc&echo=0');
	} else {
	$pages = get_pages('title_li=&child_of='.$post->ID.'&sort_column=post_date&sort_order=desc&echo=0');
}

$count = 0;

foreach($pages as $page) {
	
	$content = $page->post_content;

	if(!$content) { continue; }
	if($count >= 2) { break; }

$count++;
$content = apply_filters('the_content', $content);
?>
<li id="pages"><a href="<?php echo get_page_link($page->ID) ?>"><?php echo $page->post_title ?></a></li>
<li class="sub-list"><?php echo get_post_meta($page->ID,'listdesc',true); ?></li>
<?php
}
?>
</ul>
</div>