Determine the last child of the parent menu WP Nav Walker
Question
Is there a way to add a condition to know if the current item of the navigation walker is the last child of the menu or parent?
| Item 1 | Item 2 |
| - Item 1.1 | - Item 2.1 |
| - Item 1.2 | - Item 2.2 |
| - Item 1.3 |<----------------- Determine if current item is last child
For example:
if ($item->last_child(of_current_parent) {
...
}
So, how do you determine if the current item is the last child of its siblings?
EDIT: Solved my problem trying this: https://wordpress.stackexchange.com/a/49005/91164
But had to change the logic quite a bit to fit my needs. See my answer below.
0
menus, navigation, walker
5 years
2017-08-07T03:46:20-05:00
2017-08-07T03:46:20-05:00 0 Answers
90 views
0
Leave an answer