| | |
| | | use JVBase\managers\SEO\schemas\SchemaResolverRegistry; |
| | | use JVBase\meta\Meta; |
| | | use JVBase\managers\SEO\schemas\SchemaDefinition; |
| | | use JVBase\registrar\Registrar; |
| | | use WP_Term; |
| | | use WP_User; |
| | | |
| | |
| | | */ |
| | | public function excludeHiddenSingles(array $ids): array |
| | | { |
| | | $hiddenTypes = []; |
| | | $timelineTypes = []; |
| | | $hiddenTypes = array_map(function($type) { |
| | | return jvbCheckBase($type); |
| | | }, |
| | | Registrar::getFeatured('hide_single', 'post') |
| | | ); |
| | | |
| | | // Find post types with hide_single or is_timeline flags |
| | | foreach (JVB_CONTENT as $slug => $config) { |
| | | $postType = BASE . $slug; |
| | | $timelineTypes = array_map(function($type) { |
| | | return jvbCheckBase($type); |
| | | }, Registrar::getFeatured('is_timeline', 'post')); |
| | | |
| | | if (!empty($config['hide_single'])) { |
| | | $hiddenTypes[] = $postType; |
| | | } |
| | | |
| | | if (!empty($config['is_timeline'])) { |
| | | $timelineTypes[] = $postType; |
| | | } |
| | | } |
| | | |
| | | $hiddenIds = []; |
| | | |
| | |
| | | $post = get_post(); |
| | | if ($post) { |
| | | $postType = jvbNoBase($post->post_type); |
| | | if (defined('JVB_CONTENT') && isset(JVB_CONTENT[$postType])) { |
| | | if (Registrar::getInstance($postType)) { |
| | | $this->config = ConfigManager::for($postType); |
| | | return [ |
| | | 'objectType' => 'post', |
| | |
| | | $term = get_queried_object(); |
| | | if ($term instanceof WP_Term) { |
| | | $taxonomy = jvbNoBase($term->taxonomy); |
| | | if (defined('JVB_TAXONOMY') && isset(JVB_TAXONOMY[$taxonomy])) { |
| | | if (Registrar::getInstance($taxonomy)) { |
| | | $this->config = ConfigManager::for($taxonomy); |
| | | return [ |
| | | 'objectType' => 'term', |
| | |
| | | $user = get_queried_object(); |
| | | if ($user instanceof WP_User) { |
| | | $role = jvbUserRole($user->ID); |
| | | if (defined('JVB_USER') && isset(JVB_USER[$role])) { |
| | | if (Registrar::getInstance($role)) { |
| | | $this->config = ConfigManager::for($role); |
| | | return [ |
| | | 'objectType' => 'user', |
| | |
| | | } |
| | | $postType = jvbNoBase($postType); |
| | | |
| | | if (defined('JVB_CONTENT') && isset(JVB_CONTENT[$postType])) { |
| | | if (Registrar::getInstance($postType)) { |
| | | $this->config = ConfigManager::for($postType); |
| | | return [ |
| | | 'objectType' => 'archive', |