From 8962d6886088d8803a0e07ff4f2d943f0b6c1e2f Mon Sep 17 00:00:00 2001 From: Steve Sutton Date: Thu, 9 Jul 2015 09:10:06 -0400 Subject: [PATCH] Update to comments the side_menu function --- functions.php | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/functions.php b/functions.php index 71e06c1..e7d90c3 100644 --- a/functions.php +++ b/functions.php @@ -187,18 +187,21 @@ function glm_get_header() { // echo ''; // echo ''; + +/** + * glm_side_menu + * + * Return the Wordpress Menu for location top-bar. + * Will return the sub menu for the page based on the lowest level of menu. + * So if the page has no sub menu items it will output its siblings and the + * parent page as the title. If it has child menu items then it will display + * them and itself as the tile. + * + * @access public + * @return void + */ function glm_side_menu() { global $post; - //echo '
'.print_r($post, true).'
'; - $parents = get_post_ancestors($post->ID); - $id = (count($parents) > 1) ? $parents[0]: $post->ID; - $parent = get_page( $id ); - if ($id == 0) { - $ID = $post->ID; - } else { - $ID = $parent->ID; - } - //echo '
'.print_r($ID, true).'
'; if (($locations = get_nav_menu_locations()) && isset($locations['top-bar'])) { $menu = wp_get_nav_menu_object($locations['top-bar']); $menu_items = wp_get_nav_menu_items($menu->term_id); -- 2.17.1