Skip to content

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

Open
@nickcernis

Description

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.

Activity

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

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions