From: Steve Sutton Date: Thu, 12 Nov 2015 20:33:05 +0000 (-0500) Subject: Update side navigation X-Git-Tag: V1.0.0^2~9 X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/?a=commitdiff_plain;h=fa6b74ab9c28b96bd6ef8bccb74477a228eee6c7;p=WP-Themes%2FGovernmentEmmet.git Update side navigation For the dog license page which was a leaf node. Fixed this so if you have any nav item in more than once it will grab the second menu parent for the side name. --- diff --git a/functions.php b/functions.php index 5877e6b..c3a77a3 100644 --- a/functions.php +++ b/functions.php @@ -134,7 +134,7 @@ function glm_side_menu($mobile = false) { global $post; $sideMenu = $allMenu = $pageMenuId = array(); if (($locations = get_nav_menu_locations()) && isset($locations['top-bar'])) { - $menu = wp_get_nav_menu_object($locations['top-bar']); + $menu = wp_get_nav_menu_object($locations['top-bar']); $menu_items = wp_get_nav_menu_items($menu->term_id); foreach ((array) $menu_items as $key => $menu_item) { $sideMenu[$menu_item->menu_item_parent][] = $menu_item; @@ -144,9 +144,11 @@ function glm_side_menu($mobile = false) { } } if (count($pageMenuId) > 1) { + $thisPageMenuId = (isset($pageMenuId[1])) ? $pageMenuId[1]->ID : 0; + $thisPageMenuParent = (isset($pageMenuId[1])) ? $pageMenuId[1]->menu_item_parent : 0; foreach ($pageMenuId as $men) { if (isset($sideMenu[$men->ID]) && !empty($sideMenu[$men->ID])) { - $thisPageMenuId = $men->ID; + $thisPageMenuId = $men->ID; $thisPageMenuParent = $men->menu_item_parent; } }