From 3f42b2f218dd9872a682651c7265fdea95172320 Mon Sep 17 00:00:00 2001 From: buttle Date: Thu, 24 Mar 2022 22:42:29 +0100 Subject: [PATCH 01/12] renders wordpress menu in ' . PHP_EOL; } } -if (count($items[0]) > 0) { - render_menu($items, 0); -} + +render_menu($items, 0); ?> -- 2.39.5 From 591bca7f2b9399627aaa496c114f694cac92fb4b Mon Sep 17 00:00:00 2001 From: buttle Date: Fri, 25 Mar 2022 12:42:39 +0100 Subject: [PATCH 09/12] does not render Collections items when wordpress url is missing --- view/common/wordpress-menu.phtml | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/view/common/wordpress-menu.phtml b/view/common/wordpress-menu.phtml index b53d089..2ffbdc2 100644 --- a/view/common/wordpress-menu.phtml +++ b/view/common/wordpress-menu.phtml @@ -24,13 +24,19 @@ if ($wordpress_endpoint) { foreach ($response_data as $menu_item) { $lowered_title = strtolower($menu_item->title); $item_url = $menu_item->url; - if ($lowered_title == 'login') { // manipulate login url + if ($lowered_title == 'login') { + // manipulate login url $item_url = "/login"; } $item_title = $menu_item->title; - if ($lowered_title == 'collections') { // change Collections item - $item_title = "Project"; - $item_url = $wordpress_site; + if ($lowered_title == 'collections') { + if ($wordpress_site) { + // change Collections item + $item_title = "Project"; + $item_url = $wordpress_site; + } else { + continue; // do not render the Collections item + } } $item = [ "id" => $menu_item->ID, @@ -51,18 +57,18 @@ if (count($items[0]) == 0) { // let's create a default menu if ($wordpress_site) { $project_item = [ - "id" => 2, + "id" => 1, "title" => "Project", "url" => $wordpress_site ]; - $items[0][2] = $project_item; + $items[0][1] = $project_item; } $login_item = [ - "id" => 1, + "id" => 2, "title" => "Login", "url" => "/login" ]; - $items[0][1] = $login_item; + $items[0][2] = $login_item; } //print_r($items); -- 2.39.5 From d89708381d48f394b6f3c9a1fe2a58060de0cf0a Mon Sep 17 00:00:00 2001 From: buttle Date: Fri, 25 Mar 2022 13:09:53 +0100 Subject: [PATCH 10/12] adds menu css --- view/common/wordpress-menu.phtml | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/view/common/wordpress-menu.phtml b/view/common/wordpress-menu.phtml index 2ffbdc2..691753d 100644 --- a/view/common/wordpress-menu.phtml +++ b/view/common/wordpress-menu.phtml @@ -74,10 +74,20 @@ if (count($items[0]) == 0) { if (!function_exists('render_menu')) { function render_menu($items, $level_id) { - echo '
    ' . PHP_EOL; + if ($level_id == 0) { + echo '