added is_tree function for pages not in appearance menu
authorAnthony Talarico <talarico@gaslightmedia.com>
Tue, 23 Feb 2016 20:19:43 +0000 (15:19 -0500)
committerAnthony Talarico <talarico@gaslightmedia.com>
Tue, 23 Feb 2016 20:19:43 +0000 (15:19 -0500)
functions.php
lib/navigation.php

index 4452850..c661594 100644 (file)
@@ -149,7 +149,20 @@ function mytheme_search_loop() {
 
   <?php endwhile;
 }
+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;
+}
 add_action('thematic_searchloop', 'mytheme_search_loop');
 // End of the Contextual/Highlight Search functions
 ?>
index 69d49c1..a162c63 100644 (file)
@@ -181,7 +181,9 @@ function glm_get_menu_options()
 //}
 function glm_side_menu($mobile = false) {
         global $post;
-        if( !is_page(array(3200, 3201,3202,3203))){
+    
+    // do not use appearance menu for the following page ID's or their ancestors
+        if( !is_page(array(3200, 3201,3202,3203)) && !is_tree(3200) && !is_tree(3201) && !is_tree(3202) && !is_tree(3203)){
            
             $sideMenu = $allMenu = $pageMenuId = array();
         if (($locations = get_nav_menu_locations()) && isset($locations['top-bar'])) {
@@ -256,8 +258,9 @@ function glm_side_menu($mobile = false) {
         echo '</ul>';
     }
     echo '</ul>';
+// using page menu here for the listed page ID's above
 } else {
-    global $post;
+  
     $parents = get_post_ancestors($post->ID);
     $id = ($parents) ? $parents[count($parents)-1]: $post->ID;
     $parent = get_page( $id );