Yoast\WP\SEO\Generators\Schema
Article::generate() public Yoast 1.0
Returns Article data.
{} Это метод класса: Article{}
Хуков нет.
Возвращает
Массив. $data Article data.
Использование
$Article = new Article(); $Article->generate();
Код Article::generate() Article::generate Yoast 15.6.2
public function generate() {
$data = [
'@type' => $this->context->schema_article_type,
'@id' => $this->context->canonical . Schema_IDs::ARTICLE_HASH,
'isPartOf' => [ '@id' => $this->context->canonical . Schema_IDs::WEBPAGE_HASH ],
'author' => [ '@id' => $this->helpers->schema->id->get_user_schema_id( $this->context->post->post_author, $this->context ) ],
'headline' => $this->helpers->schema->html->smart_strip_tags( $this->helpers->post->get_post_title_with_fallback( $this->context->id ) ),
'datePublished' => $this->helpers->date->format( $this->context->post->post_date_gmt ),
'dateModified' => $this->helpers->date->format( $this->context->post->post_modified_gmt ),
'mainEntityOfPage' => [ '@id' => $this->context->canonical . Schema_IDs::WEBPAGE_HASH ],
];
// If the comments are open -or- there are comments approved, show the count.
$comments_open = \comments_open( $this->context->id );
$comment_count = \get_comment_count( $this->context->id );
if ( $comments_open || $comment_count['approved'] > 0 ) {
$data['commentCount'] = $comment_count['approved'];
}
if ( $this->context->site_represents_reference ) {
$data['publisher'] = $this->context->site_represents_reference;
}
$data = $this->add_image( $data );
$data = $this->add_keywords( $data );
$data = $this->add_sections( $data );
$data = $this->helpers->schema->language->add_piece_language( $data );
if ( \post_type_supports( $this->context->post->post_type, 'comments' ) && $this->context->post->comment_status === 'open' ) {
$data = $this->add_potential_action( $data );
}
return $data;
}