Yoast\WP\SEO\Context
Meta_Tags_Context::generate_schema_article_type()
Returns the schema article type.
Метод класса: Meta_Tags_Context{}
Хуки из метода
Возвращает
Строку|Массив<Строку>
. The schema article type.
Использование
$Meta_Tags_Context = new Meta_Tags_Context(); $Meta_Tags_Context->generate_schema_article_type();
Код Meta_Tags_Context::generate_schema_article_type() Meta Tags Context::generate schema article type Yoast 24.0
public function generate_schema_article_type() { $additional_type = $this->indexable->schema_article_type; if ( \is_null( $additional_type ) ) { $additional_type = $this->options->get( 'schema-article-type-' . $this->indexable->object_sub_type ); } /** This filter is documented in inc/options/class-wpseo-option-titles.php */ $allowed_article_types = \apply_filters( 'wpseo_schema_article_types', Schema_Types::ARTICLE_TYPES ); if ( ! \array_key_exists( $additional_type, $allowed_article_types ) ) { $additional_type = $this->options->get_title_default( 'schema-article-type-' . $this->indexable->object_sub_type ); } // If the additional type is a subtype of Article, we're fine, and we can bail here. if ( \stripos( $additional_type, 'Article' ) !== false ) { /** * Filter: 'wpseo_schema_article_type' - Allow changing the Article type. * * @param string|string[] $type The Article type. * @param Indexable $indexable The indexable. */ return \apply_filters( 'wpseo_schema_article_type', $additional_type, $this->indexable ); } $type = 'Article'; /* * If `None` is set (either on the indexable or as a default), set type to 'None'. * This simplifies is_needed checks downstream. */ if ( $additional_type === 'None' ) { $type = $additional_type; } if ( $additional_type !== $type ) { $type = [ $type, $additional_type ]; } // Filter documented on line 499 above. return \apply_filters( 'wpseo_schema_article_type', $type, $this->indexable ); }