-
-
Save musamamasood/a13cc85836fdcfa82347 to your computer and use it in GitHub Desktop.
Add blog to breadcrumbs, and remove category
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Add Blog to Breadcrumbs, remove category and add pagination in breadcrumb. | |
* @author Bill Erickson, Masood U | |
* @link http://www.billerickson.net/adding-blog-to-genesis-breadcrumbs/ | |
* @reference http://genesis.wp-a2z.org/page/2/?s=breadcrumb | |
* | |
* @param string original breadcrumb | |
* @return string modified breadcrumb | |
*/ | |
function be_add_blog_crumb( $crumb, $args ) { | |
if( is_singular( 'post' ) ) | |
$crumb = get_the_title(); | |
if (is_paged()) { | |
$crumb = 'Page ' . get_query_var( 'paged', 1 ); | |
} | |
if ( is_singular( 'post' ) || is_archive() || is_paged()) | |
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 ); | |
add_filter( 'genesis_blog_crumb', 'be_add_blog_crumb', 10, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment