wordpress-menu #56

Merged
chris merged 49 commits from wordpress-menu into develop 2022-03-25 13:12:29 +01:00
1 changed files with 11 additions and 11 deletions
Showing only changes of commit 9d3976c1cb - Show all commits

View File

@ -39,22 +39,22 @@ if ($wordpress_endpoint) {
} }
} }
} }
//print_r($items); //print_r($items);
function render_menu($items, $level_id) { if (!function_exists('render_menu')) {
echo '<ul>' . PHP_EOL; function render_menu($items, $level_id) {
foreach ($items[$level_id] as $menu_item) { echo '<ul>' . PHP_EOL;
echo '<li>' . PHP_EOL; foreach ($items[$level_id] as $menu_item) {
echo '<a href="'.$menu_item['url'].'">'.$menu_item['title'].'</a>' . PHP_EOL; echo '<li>' . PHP_EOL;
if (array_key_exists($menu_item['id'], $items)) { echo '<a href="'.$menu_item['url'].'">'.$menu_item['title'].'</a>' . PHP_EOL;
render_menu($items, $menu_item['id']); // render sub menu if (array_key_exists($menu_item['id'], $items)) {
render_menu($items, $menu_item['id']); // render sub menu
}
echo '</li>' . PHP_EOL;
} }
echo '</li>' . PHP_EOL; echo '</ul>' . PHP_EOL;
} }
echo '</ul>' . PHP_EOL;
} }
if (count($items[0]) > 0) { if (count($items[0]) > 0) {
render_menu($items, 0); render_menu($items, 0);
} }