Yoast\WP\SEO\Presentations

Indexable_Presentation::generate_twitter_title()publicYoast 1.0

Generates the Twitter title.

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

Хуков нет.

Возвращает

Строку. The Twitter title.

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

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

Код Indexable_Presentation::generate_twitter_title() Yoast 22.4

public function generate_twitter_title() {
	if ( $this->model->twitter_title ) {
		return $this->model->twitter_title;
	}

	if ( $this->context->open_graph_enabled === true ) {
		$social_template_title = $this->values_helper->get_open_graph_title( '', $this->model->object_type, $this->model->object_sub_type );
		$open_graph_title      = $this->open_graph_title;

		// 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_title ) && $social_template_title !== $open_graph_title ) {
			return $social_template_title;
		}

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

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

	return '';
}