<?php
$page_ids = sw_get_all_page_ids();
$exclude_page_ids= array(11,2,4,6,8);
global $wp_query;

$current_page = 0;
if (is_page()) {
$current_page = $wp_query->get_queried_object_id();
}

foreach($page_ids as $page_id) {
if(!sw_get_page_parent_id($page_id) &&  !(in_array($page_id, $exclude_page_ids)) ) { //If (1)

if($page_id == $current_page) {
$class=’id=”currentpage_h1″‘;
} else  {
$class=”;
}
?>
<div>
<h1 <?php echo $class; ?>><a href=”<?php echo get_page_link($page_id); ?>”><?php echo get_the_title($page_id); ?></a></h1>

<?php     if ( ($page_id == $current_page) || ($page_id == sw_get_page_parent_id($current_page)) ) { ?>

<ul id=”subpages”>
<?php wp_list_pages(“title_li=&depth=0&child_of=”.$page_id);?>
</ul>

<?php } ?>
</div>
<?php
}//End of If(1)

} // End of foreach ($page_ids
?>

Advertisements