WPSEO_Replace_Vars::get_label()privateYoast 1.0

Creates a label for prefixed replacement variables that matches the format in the editors.

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

Хуков нет.

Возвращает

Строку. The replacement variable label.

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

// private - только в коде основоного (родительского) класса
$result = $this->get_label( $replacement_variable );
$replacement_variable(строка) (обязательный)
The replacement variable.

Код WPSEO_Replace_Vars::get_label() Yoast 22.4

private function get_label( $replacement_variable ) {
	$prefix = $this->get_prefix( $replacement_variable );
	if ( $prefix === 'cf_' ) {
		return $this->strip_prefix( $replacement_variable ) . ' (custom field)';
	}

	if ( $prefix === 'ct_' ) {
		$label = $this->strip_prefix( $replacement_variable );
		$label = $this->handle_description( $label );
		return ucfirst( $label . ' (custom taxonomy)' );
	}

	if ( $prefix === 'pt_' ) {
		if ( $replacement_variable === 'pt_single' ) {
			return 'Post type (singular)';
		}

		return 'Post type (plural)';
	}

	return '';
}