Yoast\WP\SEO\Context
Meta_Tags_Context::generate_schema_page_type()
Returns the schema page type.
Метод класса: Meta_Tags_Context{}
Хуки из метода
Возвращает
Строку|Массив<Строку>
. The schema page type.
Использование
$Meta_Tags_Context = new Meta_Tags_Context(); $Meta_Tags_Context->generate_schema_page_type();
Код Meta_Tags_Context::generate_schema_page_type() Meta Tags Context::generate schema page type Yoast 24.1
public function generate_schema_page_type() { switch ( $this->indexable->object_type ) { case 'system-page': switch ( $this->indexable->object_sub_type ) { case 'search-result': $type = [ 'CollectionPage', 'SearchResultsPage' ]; break; default: $type = 'WebPage'; } break; case 'user': $type = 'ProfilePage'; break; case 'home-page': case 'date-archive': case 'term': case 'post-type-archive': $type = 'CollectionPage'; break; default: $additional_type = $this->indexable->schema_page_type; if ( \is_null( $additional_type ) ) { $additional_type = $this->options->get( 'schema-page-type-' . $this->indexable->object_sub_type ); } $type = [ 'WebPage', $additional_type ]; // Is this indexable set as a page for posts, e.g. in the WordPress reading settings as a static homepage? if ( (int) \get_option( 'page_for_posts' ) === $this->indexable->object_id ) { $type[] = 'CollectionPage'; } // Ensure we get only unique values, and remove any null values and the index. $type = \array_filter( \array_values( \array_unique( $type ) ) ); } /** * Filter: 'wpseo_schema_webpage_type' - Allow changing the WebPage type. * * @param string|array $type The WebPage type. */ return \apply_filters( 'wpseo_schema_webpage_type', $type ); }