For me to be able to use Bootstrap 4.0 among other things I need to add classes to the navigation <li>s.
To do this I need to change the menu() function from this:
Code: Select all
public static function menu()
{
$output = '';
foreach (wCMS::get('config', 'menuItems') as $key => $value) {
if ($value->visibility == "hide") {
continue;
}
$output .= '<li' . (wCMS::$currentPage === $value->slug ? ' class="active"' : '') . '><a href="' . wCMS::url($value->slug) . '">' . $value->name . '</a></li>';
}
return wCMS::hook('menu', $output)[0];
}
Code: Select all
public static function menu()
{
$output = '';
foreach (wCMS::get('config', 'menuItems') as $key => $value) {
if ($value->visibility == "hide") {
continue;
}
$output .= '<li class="nav-item nav-link' . (wCMS::$currentPage === $value->slug ? ' active"' : '"') . '><a href="' . wCMS::url($value->slug) . '">' . $value->name . '</a></li>';
}
return wCMS::hook('menu', $output)[0];
}
Is there a way for me to do this using a function in functions.php that overrides the menu() function in index.php?
Or is there any other way to do this without touching the index.php file?
Thanks in advance for your help.
Cheers.