Posts: 5
Threads: 2
Joined: Mar 2017
I installed MagicForest Theme instead of Lucid.
The original menu active label was "current active" like this:
Code:
<li class="index current active">
<a href="xxx">Home</a>
</li>
but the new theme need "uk-active" label, where can I replace it?
Thank you very much.
Posts: 5
Threads: 2
Joined: Mar 2017
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";
}
Posts: 3,491
Threads: 106
Joined: Mar 2010
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.
Posts: 6,266
Threads: 181
Joined: Sep 2011
get_navigation($currentpage,$classPrefix = "") lets you add prefixes, but it does not appear that I added it to the active classes....
hmm
Posts: 5
Threads: 2
Joined: Mar 2017
(2018-02-01, 05:21:25)Carlos Wrote: 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.
Thank you. I moved this function to theme's functions.php file.
Posts: 1,247
Threads: 82
Joined: Feb 2011
Is it possible to strip the li generating from the function?
Posts: 3,491
Threads: 106
Joined: Mar 2010
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');
function custom_menuitems_markup($menu) {
$menu = str_replace(array('<li','</li>'), array('<span','</span>'), $menu);
return $menu;
}
With this, you could still use
get_navigation
in your template, but it would output <span> tags instead of <li>'s
Posts: 1,247
Threads: 82
Joined: Feb 2011
2018-02-25, 04:40:12
(This post was last modified: 2018-02-25, 05:39:44 by datiswous.)
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.
Posts: 3,491
Threads: 106
Joined: Mar 2010
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.
Posts: 1,247
Threads: 82
Joined: Feb 2011
(2018-02-25, 19:07:38)Carlos Wrote: Anyway the file must begin with <?php
or else it will output anything before that as text, as you say.
Oh off course! Totally forgot about that, that's the reason..