Yoast\WP\SEO\Generators
Breadcrumbs_Generator::get_post_type_crumb
Adds the correct ID to the crumb array based on the ancestor provided.
Метод класса: Breadcrumbs_Generator{}
Хуков нет.
Возвращает
Строку[].
Использование
// private - только в коде основоного (родительского) класса $result = $this->get_post_type_crumb( $ancestor );
- $ancestor(Indexable) (обязательный)
- The ancestor indexable.
Код Breadcrumbs_Generator::get_post_type_crumb() Breadcrumbs Generator::get post type crumb Yoast 26.7
private function get_post_type_crumb( Indexable $ancestor ) {
$crumb = [
'url' => $ancestor->permalink,
'text' => $ancestor->breadcrumb_title,
];
switch ( $ancestor->object_type ) {
case 'post':
$crumb = $this->get_post_crumb( $crumb, $ancestor );
break;
case 'post-type-archive':
$crumb = $this->get_post_type_archive_crumb( $crumb, $ancestor );
break;
case 'term':
$crumb = $this->get_term_crumb( $crumb, $ancestor );
break;
case 'system-page':
$crumb = $this->get_system_page_crumb( $crumb, $ancestor );
break;
case 'user':
$crumb = $this->get_user_crumb( $crumb, $ancestor );
break;
case 'date-archive':
$crumb = $this->get_date_archive_crumb( $crumb );
break;
default:
// Handle unknown object types (optional).
break;
}
return $crumb;
}