diff --git a/src/MenuBuilder.php b/src/MenuBuilder.php index be75e19..6b6dceb 100644 --- a/src/MenuBuilder.php +++ b/src/MenuBuilder.php @@ -12,7 +12,7 @@ class MenuBuilder protected $menu = []; /** - * Attributes Map + * The attributes map. * * @var array */ @@ -35,15 +35,19 @@ class MenuBuilder ]; /** - * Blacklisted Classes + * The disallowed classes. * * @var array */ - protected $classes = [ + protected $disallowedClasses = [ 'current-menu', 'current_page', 'sub-menu', 'menu-item', + 'menu-item-type-post_type', + 'menu-item-object-page', + 'menu-item-type-custom', + 'menu-item-object-custom', 'menu_item', 'page-item', 'page_item', @@ -88,10 +92,7 @@ protected function filter($menu = []) return array_map(function ($item) { $classes = array_filter($item->classes, function ($class) { - return array_key_exists( - $class, - array_flip($this->classes) - ); + return ! in_array($class, $this->disallowedClasses); }); $item->classes = is_array($classes) ? implode(' ', $classes) : $classes;