Yoast\WP\SEO\Presentations

Indexable_Post_Type_Presentation::generate_twitter_creator()publicYoast 1.0

Generates the Twitter creator.

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

Хуки из метода

Возвращает

Строку. The Twitter creator.

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

$Indexable_Post_Type_Presentation = new Indexable_Post_Type_Presentation();
$Indexable_Post_Type_Presentation->generate_twitter_creator();

Код Indexable_Post_Type_Presentation::generate_twitter_creator() Yoast 22.4

public function generate_twitter_creator() {
	if ( $this->model->object_sub_type !== 'post' ) {
		return '';
	}

	$twitter_creator = \ltrim( \trim( \get_the_author_meta( 'twitter', $this->source->post_author ) ), '@' );

	/**
	 * Filter: 'wpseo_twitter_creator_account' - Allow changing the Twitter account as output in the Twitter card by Yoast SEO.
	 *
	 * @param string $twitter The twitter account name string.
	 */
	$twitter_creator = \apply_filters( 'wpseo_twitter_creator_account', $twitter_creator );

	if ( \is_string( $twitter_creator ) && $twitter_creator !== '' ) {
		return '@' . $twitter_creator;
	}

	$site_twitter = $this->options->get( 'twitter_site', '' );
	if ( \is_string( $site_twitter ) && $site_twitter !== '' ) {
		return '@' . $site_twitter;
	}

	return '';
}