Yoast\WP\SEO\Generators
Breadcrumbs_Generator::add_paged_crumb()
Adds a crumb for the current page, if we're on an archive page or paginated post.
Метод класса: Breadcrumbs_Generator{}
Хуков нет.
Возвращает
Массив
. The breadcrumbs.
Использование
// protected - в коде основоного (родительского) или дочернего класса $result = $this->add_paged_crumb( $crumbs, $current_indexable );
- $crumbs(массив) (обязательный)
- The array of breadcrumbs.
- $current_indexable(Indexable) (обязательный)
- The current indexable.
Код Breadcrumbs_Generator::add_paged_crumb() Breadcrumbs Generator::add paged crumb Yoast 21.6
protected function add_paged_crumb( array $crumbs, $current_indexable ) { $is_simple_page = $this->current_page_helper->is_simple_page(); // If we're not on a paged page do nothing. if ( ! $is_simple_page && ! $this->current_page_helper->is_paged() ) { return $crumbs; } // If we're not on a paginated post do nothing. if ( $is_simple_page && $current_indexable->number_of_pages === null ) { return $crumbs; } $current_page_number = $this->pagination_helper->get_current_page_number(); if ( $current_page_number <= 1 ) { return $crumbs; } $crumbs[] = [ 'text' => \sprintf( /* translators: %s expands to the current page number */ \__( 'Page %s', 'wordpress-seo' ), $current_page_number ), ]; return $crumbs; }