Yoast\WP\SEO\Presentations
Indexable_Presentation::generate_twitter_image
Generates the Twitter image.
Метод класса: Indexable_Presentation{}
Хуков нет.
Возвращает
Строку. The Twitter image.
Использование
$Indexable_Presentation = new Indexable_Presentation(); $Indexable_Presentation->generate_twitter_image();
Код Indexable_Presentation::generate_twitter_image() Indexable Presentation::generate twitter image Yoast 28.2
public function generate_twitter_image() {
$images = $this->twitter_image_generator->generate( $this->context );
$image = \reset( $images );
// Use a user-defined Twitter image, if present.
if ( $image && $this->context->indexable->twitter_image_source === 'set-by-user' ) {
return $image['url'];
}
// Let the Open Graph tags, if enabled, handle the rest of the fallback hierarchy.
if ( $this->context->open_graph_enabled === true && $this->open_graph_images ) {
return '';
}
// Set a Twitter tag with the featured image, or a prominent image from the content, if present.
if ( $image ) {
return $image['url'];
}
return '';
}