/** * Check if the current page is matching to the routing page. * @return bool */ private function isSpecificPage() { static $currentHierarchy; if (!isset($currentHierarchy)) { $currentPost = new Post(get_post()); $currentHierarchy = $currentPost->ancestors()->map(function (Post $post) { return urldecode($post->wpPost()->post_name); })->push(urldecode($currentPost->wpPost()->post_name)); } return $this->isSelfOrDescendant($currentHierarchy); }