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 ); }