Created
June 5, 2014 22:00
-
-
Save richtabor/30660dbb9ce06c139d96 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*===================================================================*/ | |
/* SEARCH FILTER | |
/*===================================================================*/ | |
if ( !function_exists( 'bean_search_filter' ) ) | |
{ | |
function bean_search_filter($query) | |
{ | |
if ( !$query->is_admin && $query->is_search) | |
{ | |
//UNCOMMENT BELOW TO SEARCH FOR POSTS ONLY | |
//$query->set('post_type', 'post' ); | |
//UNCOMMENT BELOW TO SEARCH FOR PORTFOLIO ONLY | |
//$query->set('post_type', 'portfolio' ); | |
//UNCOMMENT BELOW TO SEARCH FOR PAGES ONLY | |
//$query->set('post_type', 'page' ); | |
$query->set('post_type', array('page', 'post', 'portfolio') ); | |
} | |
return $query; | |
} | |
add_filter( 'pre_get_posts', 'bean_search_filter' ); | |
} //END if ( !function_exists( 'bean_search_filter' ) ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment