• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer
Genesis Theme Framework a2z

Genesis Theme Framework a2z

WordPress Dynamic API Reference

  • Home
  • Plugins
  • Shortcodes
  • APIs
  • Classes
  • Files
  • Hooks
  • Sitemap
  • Blog
Home / Parsed Source / Parsed: 49913
  protected function get_post_crumb() {

    $categories = get_the_category();

    $cat_crumb = '';

    if ( 1 === count( $categories ) ) {
      // If in single category, show it, and any parent categories.
      $cat_crumb = $this->get_term_parents( $categories[0]->cat_ID, 'category', true ) . $this->args['sep'];
    }
    if ( count( $categories ) > 1 ) {
      if ( $this->args['heirarchial_categories'] ) {
        // Show parent categories - see if one is marked as primary and try to use that.
        $primary_category_id = get_post_meta( get_the_ID(), '_category_permalink', true ); // Support for sCategory Permalink plugin.
        if ( ! $primary_category_id && function_exists( 'yoast_get_primary_term_id' ) ) {
          // Support for Yoast SEO plugin, even if the Yoast Breadcrumb feature is not enabled.
          $primary_category_id = yoast_get_primary_term_id();
        }
        if ( $primary_category_id ) {
          $cat_crumb = $this->get_term_parents( $primary_category_id, 'category', true ) . $this->args['sep'];
        } else {
          $cat_crumb = $this->get_term_parents( $categories[0]->cat_ID, 'category', true ) . $this->args['sep'];
        }
      } else {
        $crumbs = [];
        // Don't show parent categories (unless the post happen to be explicitly in them).
        foreach ( $categories as $category ) {
          $crumbs[] = $this->get_breadcrumb_link(
            get_category_link( $category->term_id ),
            '',
            $category->name
          );
        }
        $cat_crumb = implode( $this->args['list_sep'], $crumbs ) . $this->args['sep'];
      }
    }
    $crumb = $cat_crumb . single_post_title( '', false );

    
/**
 * Filter the Genesis post breadcrumb.
 *
 * @since 2.5.0
 *
 * @param string $crumb HTML markup for the post breadcrumb.
 * @param array  $args  Arguments used to generate the breadcrumbs. Documented in Genesis_Breadcrumbs::get_output().
 */
    return apply_filters( 'genesis_post_crumb', $crumb, $this->args, $cat_crumb );

  }
 

Published: 25th November 2019 | Last updated: 25th November 2019

Primary Sidebar

Information

Source ref: Genesis_Breadcrumb::get_post_crumb() – Get breadcrumb for single post, including any parent (category) crumbs.
Parse count / Source file date: 1569839049
MD5 hash: 1a98681bef59833b0b1414d6630812b6

Footer

Genesis a2z
Genesis Theme Framework a2z
WordPress Dynamic API Reference
WordPress 5.9.3
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:  genesis.wp-a2z.org
© Copyright Genesis a2z 2014-2022. All rights reserved.


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

  • Home
  • Blog
  • Sitemap
  • Sites