Conditionally remove header widget from Genesis


If you find this free website useful – why don’t you support this with a donation? It is easy…. read more ….

Genesis comes with a header widget area built in.

Occasionally you may want to remove this for specific pages.

The following code snippet in functions.php will do the trick

add_action( 'genesis_meta', 'my_remove_hr');
function my_remove_hr() {
if ( is_page( 'privacy-cookies' ) ) {
     unregister_sidebar( 'header-right' );
     }
}

The if statement will need to be adjusted depending on need,  see http://codex.wordpress.org/Conditional_Tags to see what conditions could be applied.

If you want to remove the Header Right sidebar on the whole site the code is simpler, just add this to your functions.php

unregister_sidebar( 'header-right' );

You can find other header code snippets here on the Studio Press site http://my.studiopress.com/snippets/header/

 


Leave a Reply

Your email address will not be published.