Yoast_View_Utils::generate_opengraph_disabled_alert()publicYoast 1.0

Устарела с версии 20.3. Больше не поддерживается и может быть удалена. Рекомендуется заменить эту функцию на аналог.

Generates the OpenGraph disabled alert, depending on whether the OpenGraph feature is disabled.

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

Хуков нет.

Возвращает

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

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

$Yoast_View_Utils = new Yoast_View_Utils();
$Yoast_View_Utils->generate_opengraph_disabled_alert( $type );
$type(строка)
The type of message. Can be altered to homepage, taxonomies or archives. Empty string by default.
По умолчанию: ''

Список изменений

Устарела с 20.3

Код Yoast_View_Utils::generate_opengraph_disabled_alert() Yoast 22.4

public function generate_opengraph_disabled_alert( $type = '' ) {
	_deprecated_function( __METHOD__, 'Yoast SEO 20.3' );
	$is_enabled = WPSEO_Options::get( 'opengraph', true );

	if ( $is_enabled ) {
		return '';
	}

	$message = $this->generate_opengraph_disabled_alert_text( $type );

	if ( empty( $message ) ) {
		return '';
	}

	$alert = new Alert_Presenter( $message, 'info' );

	return sprintf(
		'<div class="yoast-measure padded">%s</div>',
		$alert->present()
	);
}