Two Search Boxes: one all content, one only titles

It was not so hard and I have solved the problem, so for any one else stuck, just add: if ( isset($_GET[‘search-type’]) == ‘by-ref’ ) { add_filter( ‘posts_search’, ‘__search_by_title_only’, 500, 2 ); } where ‘by-ref’ is set in form as input type=”hidden” name=”search-type” value=”by-ref”

Search a post using the date it was posted

You can make a custom page template for this specific search page http://codex.wordpress.org/Pages#Creating_Your_Own_Page_Templates. Then set some $_GET variables (using a form with method GET). And do a custom query for these $_GET values: $date_query = new WP_Query( ‘year=” . $_GET[“year’] . ‘&monthnum=’ . $_GET[‘month’] . ‘&day=’ . $_GET[‘day’] ); Then your custom loop: <?php if … Read more

Custom Fields Not in Search Results

You can use an custom plugin for your custom fields function fb_custom_search_where($where) { // put the custom fields into an array $customs = array(‘custom_field1’, ‘custom_field2’, ‘custom_field3’); foreach( $customs as $custom ) { $query .= ” OR (“; $query .= “( m.meta_key = ‘$custom’ )”; $query .= ” AND ( m.meta_value LIKE ‘{$n}{$term}{$n}’ )”; $query .= … Read more

Multiple Category Search

I found the solution… My functions page now looks like: <?php class dropdown extends Walker_CategoryDropdown { function start_el(&$output, $category, $depth, $args) { $pad = str_repeat(‘&nbsp;’, $depth * 3); $cat_name = apply_filters( ‘list_cats’, $category->name, $category ); $output .= “\t<option class=\”level-$depth\” value=\””.$category->slug.”\””; $output .= ‘>’; $output .= $pad.$cat_name; if ( $args[‘show_count’] ) $output .= ‘&nbsp;&nbsp;(‘. $category->count .’)’; … Read more

Including Custom Meta with posts_where query

Well I managed to solve this sort of… The answer was to use separate search input boxes for each custom field being searched. Here is my working solution if anyone ever stumbles across this. function display_all_products() { global $term; $term = trim(strip_tags($_POST[‘s’])); $refnoterm = trim(strip_tags($_POST[‘ref’])); $yrterm = trim(strip_tags($_POST[‘yr’])); if(!empty($_POST[‘s’]) || !empty($_POST[‘ref’]) || !empty($_POST[‘yr’])) { if(!empty($_POST[‘s’])) … Read more