Skip to content

Enable “hide title” toggle checkbox for shop page in Genesis 3.1 #50

Open
@nickcernis

Description

Genesis 3.1 plans to add a “hide title” toggle. This won't work on the shop page by default, due to WordPress treating it as a product archive rather than a page.

We can make sure the “hide title” checkbox takes effect on the shop page with this code:

add_action( 'woocommerce_before_main_content', 'gencwooc_maybe_hide_title_on_shop_page' );
function gencwooc_maybe_hide_title_on_shop_page() {
	if ( function_exists( 'is_shop' ) && is_shop() ) {
		$title_toggle_enabled = apply_filters( 'genesis_title_toggle_enabled', true );
		$shop_id              = get_option( 'woocommerce_shop_page_id' );
		$title_hidden_on_shop = get_post_meta( $shop_id, '_genesis_hide_title', true );

		if ( $title_toggle_enabled && $title_hidden_on_shop ) {
			add_filter( 'woocommerce_show_page_title', '__return_false' );
		}
	}
}

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