Genesis Customization

Genesis Breadcrumbs not showing after Installing Yoast Plugin?

Genesis Breadcrumbs not Showing

Genesis really made blogging and development so easy. The Genesis Framework provides us with secure and search-engine-optimized foundation for our website. It comes with built-in features like multiple layouts, custom body, post classes for each post, breadcrumbs, numeric navigation and tons of other cool features. For further more optimization, WordPress SEO Plugin by Yoast really have no match. In my point of view, Genesis + Yoast = Power Website. Tell me if I ain’t right 😉

ALSO CHECK: How to Change Favicon in Genesis Child Theme?

Plugins and Frameworks gets new updates as their publisher makes any change in them. Updating Plugins, Frameworks and even the WordPress core itself is a very good step if you want your website to always have all the latest features. But sometimes updating creates some unexpected errors in the core files that’s why we should always take backup of our Databases and Files.

ALSO CHECK: Place Advertisements Below Post Title in Genesis without Plugins?

Lately, Yoast SEO Plugin had its major update which was the largest update so far. That update was very helpful for bloggers and developers. But Genesis Users had to face some issues related to Breadcrumbs. Some users reported that Breadcrumbs suddenly disappeared from their CMS. I have faced the same issue and finally realised that Yoast Breadcrumbs were Clashing with Default Genesis Breadcrumbs.

Genesis Breadcrumbs not Showing

You can enable the Genesis Breadcrumbs by going through Dashboard >> Genesis >> Theme Settings (see screenshot).

Genesis Breadcrumbs

The new update of the Yoast WordPress SEO plugin (version 1.5.x.x) overrides the Genesis breadcrumbs completely. There is a setting in the Yoast WordPress SEO admin panel which gives you the option to “Enable Breadcrumbs”:

Yoast Breadcrumbs

In previous versions, it worked the way it should. If the box was unchecked, the default Genesis breadcrumbs would display. If the box was checked, the Yoast WordPress SEO breadcrumbs would display. But since the update, the Yoast breadcrumbs will show if the “Enable Breadcrumbs” box is checked but no breadcrumbs show if the box is unchecked.

ALSO CHECK: How to Show Post Author Avatar before Post Title in Genesis?

Before discussing how we fixed this issue, you might be wondering “Why not just use the Yoast Breadcrumbs?”. We’ve added some additional functionality to the Genesis Breadcrumbs using Genesis hooks and CSS and we want to keep these changes, so we want to use the Genesis Breadcrumbs rather than the Yoast Breadcrumbs.

We won’t get into what’s causing this issue or who should be responsible for fixing this (Yoast or StudioPress?). You can read more about that on Github and WordPress support forums, along with some fixes that may be useful for non-Genesis themes.

Based on this information, there was a suggestion that removing/commenting out these lines from the Genesis Breadcrumbs function file /genesis/lib/functions/breadcrumb.php around line 61 would restore the Genesis Breadcrumbs:

Breadcrumb Function File Error

That does work, but there are a couple of issues with that too:

  1. You should never modify the core files. The next update will overwrite any changes you’ve made.
  2. If I want to switch to the Yoast Breadcrumbs, I’d prefer to do it through the admin settings than to have to go back into the code and modify things.

How to solve this Genesis Breadcrumbs related issue?

So our solution was to replace the default Genesis breadcrumbs with our custom Genesis breadcrumbs, removing the code listed above. But first we added a conditional check, which would check to see if the Yoast WordPress SEO plugin exists or if “Enable Breadcrumbs” box checked?

If it’s checked, we’ll use the Yoast breadcrumbs. But If it’s not checked, we’ll use our modified breadcrumb function (which is a copy of the default breadcrumb function minus the Yoast code).

And here’s the final code, which we have to add to our child theme’s function.php file:

add_action(‘get_header’,’abte_genesis_breadcrumbs_over_yoast_breadcrumbs’);
function abte_genesis_breadcrumbs_over_yoast_breadcrumbs() {
$wpseo_crumbs = get_option( ‘wpseo_internallinks’ );
if ( function_exists( ‘yoast_breadcrumb’ ) && $wpseo_crumbs[ ‘breadcrumbs-enable’ ] !== true ) {
// When Yoast SEO is activated, Genesis crumbs disappear
remove_action( ‘genesis_before_loop’, ‘genesis_do_breadcrumbs’ );
// Replace default genesis breadcrumbs with modified breadcrumbs to remove Yoast breadcrumbs
// Replace genesis_before_loop with another hook if you want to move breadcrumb locations
add_action( ‘genesis_before_loop’, ‘abte_genesis_do_breadcrumbs’ );
}}
function abte_genesis_do_breadcrumbs() {if (
( ( ‘posts’ === get_option( ‘show_on_front’ ) && is_home() ) && ! genesis_get_option( ‘breadcrumb_home’ ) ) ||
( ( ‘page’ === get_option( ‘show_on_front’ ) && is_front_page() ) && ! genesis_get_option( ‘breadcrumb_front_page’ ) ) ||
( ( ‘page’ === get_option( ‘show_on_front’ ) && is_home() ) && ! genesis_get_option( ‘breadcrumb_posts_page’ ) ) ||
( is_single() && ! genesis_get_option( ‘breadcrumb_single’ ) ) ||
( is_page() && ! genesis_get_option( ‘breadcrumb_page’ ) ) ||
( ( is_archive() || is_search() ) && ! genesis_get_option( ‘breadcrumb_archive’ ) ) ||
( is_404() && ! genesis_get_option( ‘breadcrumb_404’ ) ) ||
( is_attachment() && ! genesis_get_option( ‘breadcrumb_attachment’ ) )
)
return;
if ( function_exists( ‘bcn_display’ ) ) {
echo ‘<div class=”breadcrumb” itemprop=”breadcrumb”>’;
bcn_display();
echo ‘</div>’;
}
/*
* Remove Yoast function if Yoast function is not enabled
* See abte_genesis_breadcrumbs_over_yoast_breadcrumbs() function above
*
elseif ( function_exists( ‘yoast_breadcrumb’ ) ) {
yoast_breadcrumb( ‘<div class=”breadcrumb”>’, ‘</div>’ );
}
*/
elseif ( function_exists( ‘breadcrumbs’ ) ) {
breadcrumbs();
}
elseif ( function_exists( ‘crumbs’ ) ) {
crumbs();
}
else {
genesis_breadcrumb();
}}

Source – AlphaBlossom

Done!

That’s all! It will make your default Genesis Breadcrumbs to get back to work normally as they should.

If you’ve got any doubt while implementing this method then let me know by dropping a comment below 🙂

You Might Also Like

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>