Yoast\WP\SEO\Generators
Breadcrumbs_Generator::should_have_blog_crumb()
Returns whether or not a blog crumb should be added.
Метод класса: Breadcrumbs_Generator{}
Хуков нет.
Возвращает
true|false
. Whether or not a blog crumb should be added.
Использование
// protected - в коде основоного (родительского) или дочернего класса $result = $this->should_have_blog_crumb( $page_for_posts, $context );
- $page_for_posts(int) (обязательный)
- The page for posts ID.
- $context(Meta_Tags_Context) (обязательный)
- The meta tags context.
Код Breadcrumbs_Generator::should_have_blog_crumb() Breadcrumbs Generator::should have blog crumb Yoast 21.5
protected function should_have_blog_crumb( $page_for_posts, $context ) { // When there is no page configured as blog page. if ( \get_option( 'show_on_front' ) !== 'page' || ! $page_for_posts ) { return false; } if ( $context->indexable->object_type === 'term' ) { $parent = $this->get_taxonomy_post_type_parent( $context->indexable->object_sub_type ); return $parent === 'post'; } if ( $this->options->get( 'breadcrumbs-display-blog-page' ) !== true ) { return false; } // When the current page is the home page, searchpage or isn't a singular post. if ( \is_home() || \is_search() || ! \is_singular( 'post' ) ) { return false; } return true; }