Log1x / navi

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

Some kind of message when no menu assigned to location? #75

Closed MikeiLL closed 5 months ago

MikeiLL commented 5 months ago

Hey and thanks for the work.

Would it make sense to have some kind of alert message when the user hasn't yet created a menu?

One inelegant approach would be to add code to Navi->build() something like:

 if ($menu === 0 || $menu === '' || $menu === null){
    print_r("Log1x\Navi reports: No menu assigned to location. Please assign a menu to location in the WordPress admin panel.");
    die();
 }
Log1x commented 5 months ago

I feel like with how Navi works, this would be better left to the theme developer to handle whether a menu is required, etc.

MikeiLL commented 5 months ago

I see you've also updated the example, $menu->isNotEmpty(). Nice!