• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer
Yoast SEO a2z

Yoast SEO a2z

WordPress SEO a2z

  • Home
  • Plugins
  • Blocks
  • Shortcodes
  • APIs
  • Classes
  • Files
  • Hooks
  • Sitemap
  • Blog
Home / APIs / Breadcrumbs_Generator::should_have_blog_crumb() – Returns whether or not a blog crumb should be added.

You appear to be a bot. Output may be restricted

Description

Returns whether or not a blog crumb should be added.

Usage

$bool = Breadcrumbs_Generator::should_have_blog_crumb( $page_for_posts, $context );

Parameters

$page_for_posts
( int ) required – The page for posts ID.
$context
( Meta_Tags_Context ) required – The meta tags context.

Returns

bool Whether or not a blog crumb should be added.

Source

File name: wordpress-seo/src/generators/breadcrumbs-generator.php
Lines:

1 to 22 of 22
  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;
  }
 

 View on GitHub View on Trac

Published: 2nd May 2020 | Last updated: 15th June 2020

Primary Sidebar

Information

Function name: Breadcrumbs_Generator::should_have_blog_crumb
Class ref: Breadcrumbs_Generator
Plugin ref: Yoast SEO
Version: 15.4
Sourcefile: src/generators/breadcrumbs-generator.php
File ref: src/generators/breadcrumbs-generator.php
Deprecated?: No
API Letters: B,G,H,S

Footer

Yoast SEO a2z
Yoast SEO a2z
WordPress SEO a2z
WordPress 5.6
WordPress a2z
WordPress core a2z
Genesis Theme Framework a2z
Jetpack a2z
WordPress develop tests
Easy Digital Downloads a2z
WooCommerce a2z
Yoast SEO a2z
WordPress Blocks

Site:  wordpress-seo.wp-a2z.org
© Copyright Yoast SEO a2z 2017-2021. All rights reserved.


Website designed and developed by Herb Miller
Proudly powered by WordPress and oik plugins

  • Home
  • Blog
  • Sitemap
  • Sites