From: Anthony Talarico Date: Thu, 7 Jan 2016 18:22:07 +0000 (-0500) Subject: testing nav menu functionality X-Git-Tag: v1.0.0^2~113 X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/?a=commitdiff_plain;h=b42d349532f6aecbb551c39dfb1f7b772de9708a;p=WP-Themes%2Fotsego.git testing nav menu functionality --- diff --git a/functions.php b/functions.php index 41b0164..eff366a 100644 --- a/functions.php +++ b/functions.php @@ -146,4 +146,19 @@ function mytheme_search_loop() { add_action('thematic_searchloop', 'mytheme_search_loop'); // End of the Contextual/Highlight Search functions + +function is_tree( $pid ) { + global $post; + + if ( is_page($pid) ) + return true; + + $anc = get_post_ancestors( $post->ID ); + foreach ( $anc as $ancestor ) { + if( is_page() && $ancestor == $pid ) { + return true; + } + } + return false; +} ?> diff --git a/lib/navigation.php b/lib/navigation.php index 07000eb..7e780ae 100644 --- a/lib/navigation.php +++ b/lib/navigation.php @@ -187,35 +187,36 @@ function glm_get_menu_options() // echo ''."\n"; //} function glm_side_menu($mobile = false) { - + global $post; + $sideMenu = $allMenu = $pageMenuId = array(); - echo $post->ID; +// echo $post->ID; // if (($locations = get_nav_menu_locations()) && isset($locations['top-bar-1'])) { // $menu = wp_get_nav_menu_object($locations['top-bar-1']); // } - if(is_page(2666) || 2666 == $post->post_parent){ + if(is_page(2666) || 2666 == $post->post_parent || is_tree(2666)){ if (($locations = get_nav_menu_locations()) && isset($locations['top-bar-1'])) { $menu = wp_get_nav_menu_object($locations['top-bar-1']); } } - if(is_page(2665) || 2665 == $post->post_parent){ + if(is_page(2665) || 2665 == $post->post_parent || is_tree(2665)){ if (($locations = get_nav_menu_locations()) && isset($locations['top-bar-2'])) { $menu = wp_get_nav_menu_object($locations['top-bar-2']); } } - if(is_page(4593) || 4593 == $post->post_parent){ + if(is_page(4593) || 4593 == $post->post_parent || is_tree(4593)){ if (($locations = get_nav_menu_locations()) && isset($locations['top-bar-3'])) { $menu = wp_get_nav_menu_object($locations['top-bar-3']); } } - if(is_page(2664) || 2664 == $post->post_parent){ + if(is_page(2664) || 2664 == $post->post_parent || is_tree(2664)){ if (($locations = get_nav_menu_locations()) && isset($locations['top-bar-4'])) { $menu = wp_get_nav_menu_object($locations['top-bar-4']); } } - if(is_page(3363) || 3363 == $post->post_parent){ + if(is_page(3363) || 3363 == $post->post_parent || is_tree(3363)){ if (($locations = get_nav_menu_locations()) && isset($locations['top-bar-6'])) { $menu = wp_get_nav_menu_object($locations['top-bar-6']); }