testing nav menu functionality
authorAnthony Talarico <talarico@gaslightmedia.com>
Thu, 7 Jan 2016 18:22:07 +0000 (13:22 -0500)
committerAnthony Talarico <talarico@gaslightmedia.com>
Thu, 7 Jan 2016 18:22:07 +0000 (13:22 -0500)
functions.php
lib/navigation.php

index 41b0164..eff366a 100644 (file)
@@ -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;
+}
 ?>
index 07000eb..7e780ae 100644 (file)
@@ -187,35 +187,36 @@ function glm_get_menu_options()
 //    echo '</ul><!-- end -->'."\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']);
         }