Protected pages will now show the owners menu properly
authorLaury GvR <laury@gaslightmedia.com>
Thu, 8 Nov 2018 17:13:10 +0000 (12:13 -0500)
committerLaury GvR <laury@gaslightmedia.com>
Thu, 8 Nov 2018 17:13:10 +0000 (12:13 -0500)
functions.php

index 5d24398..666fe20 100644 (file)
@@ -223,28 +223,28 @@ add_action('thematic_searchloop', 'mytheme_search_loop');
  * This function returns true when the current page is the page given by ID
  *  or a descendent thereof.
  */
-function is_in_tree_theme( $pid, $pageID ) {
-    if ( is_page( $pid ) || is_single( $pid ) || is_category( $pid ) || ( $pid = get_option( 'page_for_posts' ) )  ) {
-        echo "Yeah am ancestor";
+function is_in_tree_theme( $parentID, $pageID ) {
+    if ( is_page( $parentID ) ) {
+        return true;
+    }
+    if ( is_single() || is_home() || is_category() || is_archive() ) {
         return true;
     }
     if ( $pageID ) {
-        echo "Yeah in ancestor tree";
         $anc = get_post_ancestors( $pageID );
    
         foreach ( $anc as $ancestor ) {
-            if( $ancestor == $pid ) {
+            if( $ancestor == $parentID ) {
                 return true;
             }
         }
     }
-    echo "Not in tree";
     return false;
 }
 // if (!function_exists('is_in_tree')) {
-//     function is_in_tree( $pid, $pageID = false ) {
+//     function is_in_tree( $parentID, $pageID = false ) {
         
-//         if ( is_page( $pid ) ) {
+//         if ( is_page( $parentID ) ) {
 //             return true;
 //         }
         
@@ -252,7 +252,7 @@ function is_in_tree_theme( $pid, $pageID ) {
             
 //             $anc = get_post_ancestors( $pageID );
 //             foreach ( $anc as $ancestor ) {
-//                 if(  $ancestor == $pid ) {
+//                 if(  $ancestor == $parentID ) {
 //                     return true;
 //                 }
 //             }