QUESTION How to change menu active label? - Printable Version +- GetSimple Support Forum (http://get-simple.info/forums) +-- Forum: GetSimple (http://get-simple.info/forums/forumdisplay.php?fid=3) +--- Forum: Themes (http://get-simple.info/forums/forumdisplay.php?fid=10) +--- Thread: QUESTION How to change menu active label? (/showthread.php?tid=10332) |
How to change menu active label? - bacmid - 2018-01-31 I installed MagicForest Theme instead of Lucid. The original menu active label was "current active" like this: Code: <li class="index current active"> but the new theme need "uk-active" label, where can I replace it? Thank you very much. RE: How to change menu active label? - bacmid - 2018-01-31 I found the file, it's admin/inc/theme_functions.php: ================================================ if ($page['menuStatus'] == 'Y') { $parentClass = !empty($page['parent']) ? $classPrefix.$page['parent'] . " " : ""; $classes = trim( $parentClass.$classPrefix.$url_nav); if ("$currentpage" == "$url_nav") $classes .= " current active"; 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"; } RE: How to change menu active label? - Carlos - 2018-02-01 Instead of editing GS core files, I suggest you copy the whole get_navigation function to your theme's functions.php file (create it if it doesn't exist) with a different name (e.g. "my_get_navigation"), make the "uk-active" change there, and use this new function in your template. This way you will be able to upgrade GS without having to edit theme-functions.php again.
RE: How to change menu active label? - shawn_a - 2018-02-03 get_navigation($currentpage,$classPrefix = "") lets you add prefixes, but it does not appear that I added it to the active classes.... hmm RE: How to change menu active label? - bacmid - 2018-02-09 (2018-02-01, 05:21:25)Carlos Wrote: Instead of editing GS core files, I suggest you copy the whole Thank you. I moved this function to theme's functions.php file. RE: How to change menu active label? - datiswous - 2018-02-24 Is it possible to strip the li generating from the function? RE: How to change menu active label? - Carlos - 2018-02-24 You can just edit your custom function and make the changes in the line $menu .= '<li class= ... </li>'."\n"; Another way would be adding this to your theme's functions.php: Code: add_filter('menuitems', 'custom_menuitems_markup'); With this, you could still use get_navigation in your template, but it would output <span> tags instead of <li>'s
RE: How to change menu active label? - datiswous - 2018-02-25 Thanks Carlos. Apparently this line has to be present on top of functions.php , not just for security, but otherwise it will post everything in that file as text in the top of the webpage. PHP Code: <?php if(!defined('IN_GS')){ die('you cannot load this page directly.'); } The wiki page about this doesn't mention this. RE: How to change menu active label? - Carlos - 2018-02-25 If I'm not mistaken, if(!defined('IN_GS') ... is recommended but not really required - only if the file has some code logic (function calls, etc.), but not if it just contains function definitions.Anyway the file must begin with <?php or else it will output anything before that as text, as you say.
RE: How to change menu active label? - datiswous - 2018-02-26 (2018-02-25, 19:07:38)Carlos Wrote: Anyway the file must begin with Oh off course! Totally forgot about that, that's the reason.. |