I've made it simpler for users to use i guess.. still hardcoded into theme though.
New function for
theme_functions.php in
admin/inc/
Code:
function set_navigation_item($items, $menu, $url, $title = "url", $order = "11")
{
// Setting the order to last by default
$items[] = array(
'menu' => $menu,
'url' => $url,
'title' => $title,
'custom' => true,
'menuOrder' => $order
);
return $items;
}
New get_navigation(); function to replace old one.
Code:
function get_navigation($currentpage, $extra = "") {
global $PRETTYURLS;
global $SITEURL;
$menu = '';
$path = "data/pages";
$dir_handle = @opendir($path) or die("Unable to open $path");
$filenames = array();
while ($filename = readdir($dir_handle)) {
$filenames[] = $filename;
}
$count="0";
$pagesArray = array();
if (count($filenames) != 0) {
foreach ($filenames as $file) {
if ($file == "." || $file == ".." || is_dir("data/pages/".$file) || $file == ".htaccess" ) {
// not a page data file
} else {
$thisfile = @file_get_contents('data/pages/'.$file);
$data = simplexml_load_string($thisfile);
if ($data->private != 'Y') {
$pagesArray[$count]['menuStatus'] = $data->menuStatus;
$pagesArray[$count]['menuOrder'] = $data->menuOrder;
$pagesArray[$count]['menu'] = stripslashes(htmlspecialchars_decode($data->menu, ENT_QUOTES));
$pagesArray[$count]['url'] = $data->url;
$pagesArray[$count]['title'] = stripslashes(htmlspecialchars_decode($data->title, ENT_QUOTES));
$pagesArray[$count]['parent'] = $data->parent;
$count++;
}
}
}
}
if($extra != ""){
foreach($extra as $item)
{
$pagesArray[] = $item;
}
}
$pagesSorted = subval_sort($pagesArray,'menuOrder');
if (count($pagesSorted) != 0) {
foreach ($pagesSorted as $page) {
$sel = ''; $classes = '';
$url_nav = $page['url'];
if($page['custom']) {
if ($currentpage == $url_nav) { $classes = "current"; } else { $classes = ""; }
$menu .= '<li class="' . $classes . '"><a href="' . $url_nav . '" title="' . $page['title'] . '">'. $page['menu'] .'</a></li>'."\n";
} else if ($page['menuStatus'] == 'Y') {
if ("$currentpage" == "$url_nav") { $classes = "current ". $url_nav; } else { $classes = $url_nav; }
if ($page['menu'] == '') { $page['menu'] = $page['title']; }
if ($page['title'] == '') { $page['title'] = $page['menu']; }
if ($PRETTYURLS == '1') {
if ($page['parent'] != '' ) { $page['parent'] = tsl($page['parent']); }
if ($url_nav == 'index' ) { $url_nav = ''; }
$menu .= '<li class="'. $classes .'" ><a href="'. $SITEURL . @$page['parent'] . $url_nav .'" title="'. $page['title'] .'">'.$page['menu'] .'</a></li>'."\n";
} else {
$menu .= '<li class="'. $classes .'" ><a href="'. $SITEURL .'index.php?id='.$url_nav.'" title="'. $page['title'] .'">'.$page['menu'].'</a></li>'."\n";
}
}
}
echo $menu;
}
closedir($dir_handle);
}
Using it:
Code:
<?php
$items = set_navigation_item($items, 'twitter', 'http://twitter.com');
$items = set_navigation_item($items, 'google', 'http://google.com');
$items = set_navigation_item($items, 'top', 'top/','url',1); // menu item name, url, title, priority
get_navigation(return_page_slug(), $items);
?>
Example: http://nijikokun.com
seems pointless now after coding it D: cause hardcoding it is a lot easier.