Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable “hide breadcrumbs” toggle checkbox for shop page with Genesis 3.1 #49

Open
nickcernis opened this issue Jul 15, 2019 · 0 comments

Comments

@nickcernis
Copy link
Contributor

nickcernis commented Jul 15, 2019

Genesis 3.1 will add a “hide breadcrumbs” toggle to the block editor.

This will not work on the WooCommerce shop page by default, but we could enable it via this plugin with a new filter:

add_filter( 'genesis_do_breadcrumbs', 'gencwooc_maybe_hide_breadcrumbs_on_shop_page' );
function gencwooc_maybe_hide_breadcrumbs_on_shop_page( $is_hidden ) {
	if ( function_exists( 'is_shop' ) && is_shop() ) {
		$breadcrumbs_toggle_enabled  = apply_filters( 'genesis_breadcrumbs_toggle_enabled', true );
		$id                          = get_option( 'woocommerce_shop_page_id' );
		$breadcrumbs_enabled_on_shop = get_post_meta( $id, '_genesis_hide_breadcrumbs', true );

		if ( $breadcrumbs_toggle_enabled ) {
			return $breadcrumbs_enabled_on_shop;
		}
	}

	return $is_hidden;
}

Other WooCommerce pages (cart, checkout) will work by default in Genesis.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant