From: Steve Sutton Date: Thu, 9 Jul 2015 13:10:06 +0000 (-0400) Subject: Update to comments the side_menu function X-Git-Tag: v1.0.0~49^2~136 X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/?a=commitdiff_plain;h=8962d6886088d8803a0e07ff4f2d943f0b6c1e2f;p=WP-Themes%2Fcrawfordco.git Update to comments the side_menu function --- 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);