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 title” toggle checkbox for shop page in Genesis 3.1 #50

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

Comments

@nickcernis
Copy link
Contributor

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' );
		}
	}
}
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