Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Navigation - Active link class
#3
If you wish to have your own menu style, create a file "functions.php" in your template directory.

add this code inside (from theme_functions.php in admin/inc) :
Code:
function get_navigation($currentpage) {

    $menu = '';

    global $pagesArray;
    
    $pagesSorted = subval_sort($pagesArray,'menuOrder');
    if (count($pagesSorted) != 0) {
        foreach ($pagesSorted as $page) {
            $sel = ''; $classes = '';
            $url_nav = $page['url'];
            
            if ($page['menuStatus'] == 'Y') {
                if ("$currentpage" == "$url_nav") { $classes = "current ". $page['parent'] ." ". $url_nav; } else { $classes = trim($page['parent'] ." ". $url_nav); }
                if ($page['menu'] == '') { $page['menu'] = $page['title']; }
                if ($page['title'] == '') { $page['title'] = $page['menu']; }
                $menu .= '<li class="'. $classes .'"><a href="'. find_url($page['url'],$page['parent']) . '" title="'. encode_quotes(cl($page['title'])) .'">'.strip_decode($page['menu']).'</a></li>'."\n";
            }
        }
        
    }
    
    echo exec_filter('menuitems',$menu);
}
Don't forget to add this line at the beginning of this file :
Code:
<?php if(!defined('IN_GS')){ die('you cannot load this page directly.'); }
and finish file with :
Code:
?>
rename the function like : get_my_navigation

edit it as you want.

in your theme you have to call this new function instead of get-navigation.
Reply


Messages In This Thread
Navigation - Active link class - by soy - 2012-04-07, 22:36:53
Navigation - Active link class - by mvlcek - 2012-04-08, 00:08:27
Navigation - Active link class - by didou038 - 2012-04-08, 00:34:58
Navigation - Active link class - by soy - 2012-04-08, 03:11:09



Users browsing this thread: 1 Guest(s)