Skip to content

Commit

Permalink
enhance(navi): General improvements to Navi class (#35)
Browse files Browse the repository at this point in the history
  • Loading branch information
Log1x authored Feb 20, 2021
2 parents db211fc + a0f6b58 commit 51f6710
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/Navi.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,14 @@ public function __construct($items = [])
/**
* Build and assign the navigation menu items to the Navi instance.
*
* @param int|string|WP_Term $menu
* @param int|string|\WP_Term $menu
* @return $this
*/
public function build($menu = 'primary_navigation')
{
if (is_string($menu)) {
$menu = array_key_exists($menu, get_nav_menu_locations()) ?
get_nav_menu_locations()[$menu] :
$menu;
$locations = get_nav_menu_locations();
$menu = array_key_exists($menu, $locations) ? $locations[$menu] : $menu;
}

$this->menu = wp_get_nav_menu_object($menu);
Expand Down Expand Up @@ -96,7 +95,7 @@ public function isEmpty()
*/
public function isNotEmpty()
{
return ! empty($this->items);
return ! $this->isEmpty();
}

/**
Expand Down

0 comments on commit 51f6710

Please sign in to comment.