Get parent posts by path. Currently, this method only supports getting parents of the ‘page’ post type. The goal of this function is to create a clear path back to home given what would normally be a “ghost” directory. If any page matches the given path, it’ll be added.
Searches for term parents of hierarchical taxonomies. This function is similar to the WordPress function get_category_parents() but handles any type of taxonomy.
Gets post types by slug. This is needed because the get_post_types() function doesn’t exactly match the ‘has_archive’ argument when it’s set as a string instead of a boolean.
Runs through the various WordPress conditional tags to check the current page being viewed. Once a condition is met, a specific method is launched to add items to the $items array.