Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Remove Search Bar on Select Pages - Uses a Custom Body Class. See blog post on http://winningagent.com
<?php
//Remove line above; don't include it.
// Starting at line 157 in your functions.php, find this and comment out with /* */ as shown:
// Add search widget below header.
/*add_action( 'genesis_after_header', 'wap_search_bar' );
function wap_search_bar() {
genesis_widget_area( 'search-bar', array(
'before'=> '<div class="search-bar"><div class="wrap">',
'after' => '</div></div>',
) );
}*/
// Add this just below the commented out code:
// Add search widget below header.
add_action( 'genesis_after_header', 'wap_search_bar' );
function wap_search_bar() {
$body_classes = get_body_class();
if ( !in_array( 'no-search-bar', $body_classes ) ) {
genesis_widget_area( 'search-bar', array(
'before' => '<div class="search-bar"><div class="wrap">',
'after' => '</div></div>',
) );
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.