Hi, thanks for being here.
Working in a WordPress Theme.. I’m trying to add a parent class for menu items, and I’m using this code from the Codex: How to add a parent class for menu item
add_filter('wp_nav_menu_objects', function ($items) {
$hasSub = function ($menu_item_id, &$items) {
foreach ($items as $item) {
if ($item->menu_item_parent && $item->menu_item_parent==$menu_item_id) {
return true;
}
}
return false;
};
foreach ($items as &$item) {
if ($hasSub($item->ID, &$items)) {
$item->classes[] = 'menu-parent-item'; // all elements of field "classes" of a menu item get join together and render to class attribute of <li> element in HTML
}
}
return $items;
});</li>
But
for some reason I get a syntax error again and again, I think it’s because my version PHP is older than 5.3.0, but I dont know what to do 
Please somebody help me!
Thanks guys 
You should also specify the syntax error.
hi
I dont know what error you exactly get but I see putting the li tag is wrong.
when I just copy and paste your code into dreamweaver I easily see that is wrong..
Hi, thanks.
This is the error: “Parse error: syntax error, unexpected T_FUNCTION in /home/content/00/8677800/html/hungry/wp-content/themes/hungry/functions.php on line 398”
Instead of placing all the code on the same line create some line breaks that make sense on the code and it will show you at least if all brackets and parenthesis are correct.
After doing this you should know more exactly where the error lives, because you’ll split the 398 line of code 
what is line 398? is that the code that you wrote above?
I guess , it is because the way that you write li tag. also needs a break between “ement in HTML } }” (after html) like this;
ement in HTML
} }
try to delete the /li tag at the end just to learn if it works.
Thanks @Pirenko @wopre I found a solution adding a function to my Walker_Nav_Menu there is the easy way to add sub-menu class indicator to parent menu items
Thanks mates!
