Yoast\WP\SEO\Builders

Indexable_Post_Type_Archive_Builder::get_breadcrumb_title()privateYoast 1.0

Returns the fallback breadcrumb title for a given post.

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

Хуков нет.

Возвращает

Строку.

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

// private - только в коде основоного (родительского) класса
$result = $this->get_breadcrumb_title( $post_type );
$post_type(строка) (обязательный)
The post type to get the fallback breadcrumb title for.

Код Indexable_Post_Type_Archive_Builder::get_breadcrumb_title() Yoast 22.4

private function get_breadcrumb_title( $post_type ) {
	$options_breadcrumb_title = $this->options->get( 'bctitle-ptarchive-' . $post_type );

	if ( $options_breadcrumb_title !== '' ) {
		return $options_breadcrumb_title;
	}

	$post_type_obj = \get_post_type_object( $post_type );

	if ( ! \is_object( $post_type_obj ) ) {
		return '';
	}

	if ( isset( $post_type_obj->label ) && $post_type_obj->label !== '' ) {
		return $post_type_obj->label;
	}

	if ( isset( $post_type_obj->labels->menu_name ) && $post_type_obj->labels->menu_name !== '' ) {
		return $post_type_obj->labels->menu_name;
	}

	return $post_type_obj->name;
}