adding is_tree function for the separate menu locations
authorAnthony Talarico <talarico@gaslightmedia.com>
Thu, 9 Aug 2018 17:43:32 +0000 (13:43 -0400)
committerAnthony Talarico <talarico@gaslightmedia.com>
Thu, 9 Aug 2018 17:43:32 +0000 (13:43 -0400)
functions.php

index ea71f68..c1b7f56 100644 (file)
@@ -180,7 +180,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;
+}
 function is_post_type($type){
     global $wp_query;
     if($type == get_post_type($wp_query->post->ID)) return true;