Skip to content

Instantly share code, notes, and snippets.

@WAcode27
Last active November 23, 2015 20:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save WAcode27/7fe23d2258bd9f962c26 to your computer and use it in GitHub Desktop.
Save WAcode27/7fe23d2258bd9f962c26 to your computer and use it in GitHub Desktop.
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