writeNavigation(); ?> custom tree: writeNavigation(false,'',$noShow); ?> write crumbs: writeCrumbs(); ?>

Remember that you can customize the tree as you wish (ad categories by hand, etc.) and that XHTML+CSS has some great tricks for this stuff... you should get it: */ // add action to init $oaktree = new oaktree(); add_action('init',array(&$oaktree, 'initialize')); class oaktree { var $tree = array(); // constructor function oaktree() { if (!strpos($_SERVER[REQUEST_URI],'/wp-admin/')){ $this->tree = $this->buildTree(0,get_bloginfo('wpurl').'/',''); } } function initialize(){ // do tree inserts, etc. in the future } // build a hierarchical array of your page structure, used recursively function buildTree($parent=0,$prevPath='/',$exclude=''){ // build exclude string $excludeString = ''; if ($exclude){ $toExclude = explode(',',$exclude); foreach ($toExclude as $pageId){ $excludeString.= "AND p.ID != $pageId "; } } // set query $query = " SELECT ID, post_title, post_parent, post_name FROM wp_posts as p WHERE post_category = 0 $excludeString AND post_parent = $parent AND post_status = 'static' ORDER by menu_order "; // do query $pages = $GLOBALS[wpdb]->get_results($query); if($pages){ // loop through the results foreach ($pages as $page){ // check is branch active if(strpos($_SERVER[REQUEST_URI],"$page->post_name/")){ $isActive = true; $GLOBALS['oaktree_crumbID'][] = $page->ID; $GLOBALS['oaktree_crumbs'][] = array ( 'title' => $page->post_title, 'path' => $prevPath.$page->post_name.'/', ); } // insert page to array $pagetree[$page->ID] = array ( "id" => $page->ID, "title" => $page->post_title, "path" => $prevPath.$page->post_name.'/', "active" => $isActive, ); // if page is active, get sub pages if ($isActive) { $pagetree[$page->ID][sub] = $this->buildTree($page->ID, $prevPath.$page->post_name.'/',$exclude); } unset($isActive); } } return $pagetree; } // end buildTree function returnTree($id='0'){ if($id){ $subTree = $this->tree; return $subTree[$id][sub]; } else { return $this->tree; } } function setPath($id,$newPath){ $this->tree[$id][path] = $newPath; } function writeNavigation($noUnfold=false, $noShow='', $tempTree='',$widget=''){ // if no tree given, use full if(!$tempTree){ $tempTree = $this->tree; } // begin list echo "\n"; ?>
»