From 2829262157f602c2cd44ec3087d9a9b14a81dad1 Mon Sep 17 00:00:00 2001 From: Anthony Talarico Date: Thu, 11 Oct 2018 13:34:10 -0400 Subject: [PATCH] fixing the is in tree function for the nav menu checking so that it isn't overwritten by the member db plugin --- functions.php | 43 ++++++++++++++++++++++++++++++------------- sections/header.php | 13 ++++++++++--- 2 files changed, 40 insertions(+), 16 deletions(-) diff --git a/functions.php b/functions.php index 8a1ca73..2e8a7f7 100644 --- a/functions.php +++ b/functions.php @@ -223,23 +223,40 @@ 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. */ -if (!function_exists('is_in_tree')) { - function is_in_tree( $pid ) { - global $post; - if ( is_page( $pid ) ) { - return true; - } - if ($post) { - $anc = get_post_ancestors( $post->ID ); - foreach ( $anc as $ancestor ) { - if( is_page() && $ancestor == $pid ) { - return true; - } +function is_in_tree_theme( $pid, $pageID ) { + if ( is_page( $pid ) ) { + return true; + } + if ( $pageID ) { + $anc = get_post_ancestors( $pageID ); + + foreach ( $anc as $ancestor ) { + if( $ancestor == $pid ) { + return true; } } - return false; } + return false; } +// if (!function_exists('is_in_tree')) { +// function is_in_tree( $pid, $pageID = false ) { + +// if ( is_page( $pid ) ) { +// return true; +// } + +// if ( $pageID ) { + +// $anc = get_post_ancestors( $pageID ); +// foreach ( $anc as $ancestor ) { +// if( $ancestor == $pid ) { +// return true; +// } +// } +// } +// return false; +// } +// } // The GLM Simple Messageboard needs this function to display its data if ( !function_exists( 'glm_get_simplemessageboard_option' ) ) { diff --git a/sections/header.php b/sections/header.php index e43344a..fce8693 100644 --- a/sections/header.php +++ b/sections/header.php @@ -4,12 +4,19 @@ - +