Tag Info

Hot answers tagged

4

A meta_query is an array of arrays. You only have an array. $query->set('meta_query', array( 'key' => 'shru_price', 'value' => $_GET['minPrice'], 'compare' => '>=', 'type' => 'NUMERIC' )); It should be: $query->set( 'meta_query', array( array( 'key' => 'shru_price', ...


2

I think this is what you want. base is set via home_url(), format is page/%#%/, search query arg is added via add_args if it exists: $args = array( 'base' => home_url( '/%_%' ), 'format' => 'page/%#%/', 'current' => max( 1, get_query_var('paged') ), 'total' => $temp->max_num_pages, ); if( isset($_GET['s']) ){ ...


1

Creating custom search is not the easiest of tasks for beginners. You will need templates search.php and searchform.php - View Codex. You can then edit searchform.php and add any fields you need. When the user submits the form it will also add any extra fields you have - so your search url may look something like this /?s=1000&num=5&type=years ...


1

In Google Site search, you can set up Refinements ( Edit Search engine - > Search Features -> Refinements tab. You can also set synonyms and promotions (so that particular pages will always appear at the top of specific search results pages). The Google content is based on spidering though, so it won't understand back-end concepts such as 'tags' or ...


1

Curiously there is no clean/explicit way to short circuit WP_Query. If it's main query you might work something out around WP->parse_request(), there seems to be relatively recent (3.5) do_parse_request filter there. But for WP_Query itself dirty hacks are usually in order, such as short-circuiting SQL query by adding AND 1=0 via posts_where filter, ...


1

The problems on set a query parameter to unexistent value are 2: The query will run, so even if you already know will be no results there is a little performance price to pay WordPress queries has 19 different 'posts_*' filter hooks ('posts_where', 'post_join', etc..) that act on query, so you can never be sure that even setting unexistent param the query ...


1

The default search is handled by WP_Query mostly by a method called parse_search(), which is triggered by the s parameter. You can search the source of WP_Query for is_search and piece together a few other bits and pieces. Or you can just create a query... $s = new WP_Query(array('s' => 'test')); ... dump the SQL... var_dump($s->request); ... ...



Only top voted, non community-wiki answers of a minimum length are eligible