I need help with changing php code on my page.
I don't know php, so I would very much appreciate if you could tell me what the broken code should look like, because I do not know, waht to delete, what to keep :(
// remove current-menu and current-menu-ancestor classes to lang switcher when not on the home page
function wp_nav_menu_objects($items) {
$r_ids = $k_ids = array();
foreach ($items as $item) {
if (in_array('current-lang', $item->classes)) {
$item->classes = array_diff($item->classes, array('current-menu-item'));
$r_ids = array_merge($r_ids, $this->get_ancestors($item)); // remove the classes for these ancestors
}
elseif (in_array('current-menu-item', $item->classes))
$k_ids = array_merge($k_ids, $this->get_ancestors($item)); // keep the classes for these ancestors
[Please post code & markup between backticks or use the code button. Your posted code may now have been permanently damaged by the forum's parser.]
Please help and show me the correct code, I should insert in my nav-menu.php file.
Thanks!