Posts: 27
Threads: 6
Joined: Jan 2012
Hi,
where are the files / lines to change the code, in which the navigation adds the 'class="current"' attribute to the active navigationpoint? I would like to cut it out there and paste it in the <a href=""> Attribute for the navigationpoints!
Sorry, cannot find it on my own...
Thanks and happy easter-days!
I LOVE this place. Thanks for making such a great piece of code!
Posts: 2,094
Threads: 54
Joined: Jan 2011
soy Wrote:where are the files / lines to change the code, in which the navigation adds the 'class="current"' attribute to the active navigationpoint? I would like to cut it out there and paste it in the <a href=""> Attribute for the navigationpoints!
Why would you want to do that?
Any CSS rule
a.current can also be defined as
li.current a.
Changing code in GetSimple or a plugin is not a good idea as it makes updating to a new version much harder.
And if you still want to do it, just search for
get_navigation or
current in the /admin folder and below.
Posts: 112
Threads: 20
Joined: Dec 2011
2012-04-08, 00:34:58
(This post was last modified: 2012-04-08, 00:35:52 by mklemme.)
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 :
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.
Posts: 27
Threads: 6
Joined: Jan 2012
Oh my god, thanks a lot mvlcek, you are totally right. I do not know why I did not came across with that solution...
Thanks, too, didou. I will keep this in mind for other projects and custom settings!
You guys are great! Thanks (:
I LOVE this place. Thanks for making such a great piece of code!