Yoast_View_Utils::generate_opengraph_disabled_alert_text()privateYoast 1.0

Generates the OpenGraph disabled alert text.

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

Хуков нет.

Возвращает

Строку. The alert. Returns an empty string if the setting is enabled.

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

// private - только в коде основоного (родительского) класса
$result = $this->generate_opengraph_disabled_alert_text( $type );
$type(строка) (обязательный)
The type of message. Can be altered to homepage, taxonomies or archives. Empty string by default.

Код Yoast_View_Utils::generate_opengraph_disabled_alert_text() Yoast 22.4

private function generate_opengraph_disabled_alert_text( $type ) {
	if ( $type === 'homepage' ) {
		return sprintf(
			/* translators: 1: link open tag; 2: link close tag. */
			esc_html__(
				'The social appearance settings for your homepage require Open Graph metadata (which is currently disabled). You can enable this in the %1$s‘Social’ settings under the ‘Facebook’ tab%2$s.',
				'wordpress-seo'
			),
			'<a href="' . esc_url( admin_url( 'admin.php?page=wpseo_social#top#facebook' ) ) . '">',
			'</a>'
		);
	}

	if ( ! YoastSEO()->helpers->product->is_premium() ) {
		return '';
	}

	if ( $type === '' ) {
		return sprintf(
			/* translators: 1: link open tag; 2: link close tag. */
			esc_html__(
				'The social appearance settings for content types require Open Graph metadata (which is currently disabled). You can enable this in the %1$s‘Social’ settings under the ‘Facebook’ tab%2$s.',
				'wordpress-seo'
			),
			'<a href="' . esc_url( admin_url( 'admin.php?page=wpseo_social#top#facebook' ) ) . '">',
			'</a>'
		);
	}

	if ( $type === 'taxonomies' ) {
		return sprintf(
			/* translators: 1: link open tag; 2: link close tag. */
			esc_html__(
				'The social appearance settings for taxonomies require Open Graph metadata (which is currently disabled). You can enable this in the %1$s‘Social’ settings under the ‘Facebook’ tab%2$s.',
				'wordpress-seo'
			),
			'<a href="' . esc_url( admin_url( 'admin.php?page=wpseo_social#top#facebook' ) ) . '">',
			'</a>'
		);
	}

	if ( $type === 'archives' ) {
		return sprintf(
			/* translators: 1: link open tag; 2: link close tag. */
			esc_html__(
				'The social appearance settings for archives require Open Graph metadata (which is currently disabled). You can enable this in the %1$s‘Social’ settings under the ‘Facebook’ tab%2$s.',
				'wordpress-seo'
			),
			'<a href="' . esc_url( admin_url( 'admin.php?page=wpseo_social#top#facebook' ) ) . '">',
			'</a>'
		);
	}

	return '';
}