1

The start_lvl() method allows to know the current $depth parameter. But, I need to output different results at level 1 if the menu has x or y total levels.

I did a print_r() of the $args array, but there isn't anything I can use to achieve the desired result:

<!--Custom_Menu_Walker Object
(
    [tree_type] => Array
        (
            [0] => post_type
            [1] => taxonomy
            [2] => custom
        )

    [db_fields] => Array
        (
            [parent] => menu_item_parent
            [id] => db_id
        )

    [max_pages] => 1
    [has_children] => 1
)
-->

The most useful thing is to know if the current level has children. And even that isn't supposed to be used in the walker level:

From the docs: Whether the current element has children or not. To be used in start_el().

And even though it can be accessed from level, it doesn't allow me to know if any of the children have more children.

How do you suggest to approach this?

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.