Lego2012
12/13/2016 - 4:47 PM

Adding “Blog” to Genesis Breadcrumbs

Adding “Blog” to Genesis Breadcrumbs

<?php
//* Do NOT include the opening php tag shown above. Copy the code shown below.

/**
 * Add Blog to Breadcrumbs
 * @author Bill Erickson
 * @link http://www.billerickson.net/adding-blog-to-genesis-breadcrumbs/
 *
 * @param string original breadcrumb
 * @return string modified breadcrumb
 */
function be_add_blog_crumb( $crumb, $args ) {
    if ( is_singular( 'post' ) || is_category() )
        return '<a href="' . get_permalink( get_option( 'page_for_posts' ) ) . '">' . get_the_title( get_option( 'page_for_posts' ) ) .'</a> ' . $args['sep'] . ' ' . $crumb;
    else
        return $crumb;
}
add_filter( 'genesis_single_crumb', 'be_add_blog_crumb', 10, 2 );
add_filter( 'genesis_archive_crumb', 'be_add_blog_crumb', 10, 2 );