How do I know if a menu item has children or is a leaf?
-
Hi there!
I’m developing a new theme and I need to mark menu items without children differently from “leaf” (no children) ones. Ideally with a css class for the “parents” – has-children, or similar. This is how my walker code looks now:
class My_Walker_Nav_Menu extends Walker_Nav_Menu {
function start_el(&$output, $item, $depth, $args) {
...
if(??? $item has children???) {
// I know what to do here
}
}
}
What should I put between the
???
s ?Thanks and regards!
PS: This question is also in StackOverflow and has a bounty of 100 rep points. Please feel free to answer there and I will gladly grant you those points.
Viewing 7 replies - 1 through 7 (of 7 total)
Viewing 7 replies - 1 through 7 (of 7 total)
- The topic ‘How do I know if a menu item has children or is a leaf?’ is closed to new replies.