Forum Replies Created

Viewing 1 replies (of 1 total)
  • Great script. I’ve updated it to work with navigation with more than two levels deep without losing the absolute parent.

    function is_tree($pid)
    {
    	global $post;
    
    	$ancestors = get_post_ancestors($post->$pid);
    	$root = count($ancestors) - 1;
    	$parent = $ancestors[$root];
    
    	if(is_page() && (is_page($pid) || $post->post_parent == $pid || in_array($pid, $ancestors)))
    	{
    		return true;
    	}
    	else
    	{
    		return false;
    	}
    };
Viewing 1 replies (of 1 total)