Yoast\WP\SEO\Presentations

Indexable_Presentation::generate_twitter_description()publicYoast 1.0

Generates the Twitter description.

Метод класса: Indexable_Presentation{}

Хуков нет.

Возвращает

Строку. The Twitter description.

Использование

$Indexable_Presentation = new Indexable_Presentation();
$Indexable_Presentation->generate_twitter_description();

Код Indexable_Presentation::generate_twitter_description() Yoast 22.4

public function generate_twitter_description() {
	if ( $this->model->twitter_description ) {
		return $this->model->twitter_description;
	}

	if ( $this->context->open_graph_enabled === true ) {
		$social_template_description = $this->values_helper->get_open_graph_description( '', $this->model->object_type, $this->model->object_sub_type );
		$open_graph_description      = $this->open_graph_description;

		// If the helper returns a value and it's different from the OG value in the indexable,
		// output it in a twitter: tag.
		if ( ! empty( $social_template_description ) && $social_template_description !== $open_graph_description ) {
			return $social_template_description;
		}

		// If the OG description is set, let og: tag take care of this.
		if ( ! empty( $open_graph_description ) ) {
			return '';
		}
	}

	if ( $this->meta_description ) {
		return $this->meta_description;
	}

	return '';
}