Log1x / navi

A developer-friendly alternative to the WordPress NavWalker.
https://github.com/Log1x/navi
MIT License
315 stars 30 forks source link

Nav setup #24

Closed dottd-admin closed 4 years ago

dottd-admin commented 4 years ago

If setting up multiple navs can this be adapted to return also a secondary nav eg. footer nav? So essentially, without the need to create separate php files for each nav?

    /**
     * Returns the primary navigation.
     *
     * @return array
     */
    public function navigation()
    {
        if (Navi::build('primary')->isEmpty()) {
            return;
        }

        return Navi::build('primary')->toArray();
    }
}
Log1x commented 4 years ago

You'd just create another method.

    /**
     * Returns the footer navigation.
     *
     * @return array
     */
    public function footerNav()
    {
        if (Navi::build('footer_navigation')->isEmpty()) {
            return;
        }

        return Navi::build('footer_navigation')->toArray();
    }

and then add 'footerNav' => $this->footerNav() to $with

dottd-admin commented 4 years ago

That done the trick perfectly. Thanks 👍