From c48a6d57090a708a5756ad5000b1b1d395683d2e Mon Sep 17 00:00:00 2001 From: buttle Date: Fri, 25 Mar 2022 10:00:24 +0100 Subject: [PATCH] improves menu item iteration --- view/common/wordpress-menu.phtml | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-) diff --git a/view/common/wordpress-menu.phtml b/view/common/wordpress-menu.phtml index af99f8d..480f5d7 100644 --- a/view/common/wordpress-menu.phtml +++ b/view/common/wordpress-menu.phtml @@ -27,28 +27,13 @@ foreach ($response_items as $menu_item) { //print_r($items); -if (!function_exists('menu_level_items')) { - function menu_level_items($items, $level_id) { - $level_items = new ArrayObject(); - foreach ($items as $menu_level) { - foreach ($menu_level as $menu_item) { - if ($menu_item['menu_item_parent'] == $level_id) { - $level_items->append($menu_item); - } - } - } - return $level_items; - } -} - if (!function_exists('render_menu')) { function render_menu($items, $level_id) { - $level_items = menu_level_items($items, $level_id); echo '