Any way to do this? I'd like for all the search results to be run through wp advanced search ( https://github.com/growthspark/wp-advanced-search ) so they appear on the wp advanced search page template instead of the default way provided by my theme.

  • The code in question doesn't seem to come with template, just with instructions how to integrate it. Please elaborate on what code you have implemented already and what you have trouble achieving. – Rarst Dec 5 '13 at 20:19

You can use template include filter to use it on every search request.

Let's assume the advanced search page template you are using is 'wp-advanced-search.php' you can use locate_template to get its path:

add_action('template_include', 'advanced_search_tmpl');

function advanced_search_tmpl( $template ) {
  if ( is_search() ) {
     $t = locate_template('wp-advanced-search.php', false);
     if ( ! empty($t) ) $template = $t;
  return $template;
  • Don't we still have to change the query itself because if you run a search in wp advanced search it looks like this in the url http://localhost:8888/wordpress/?page_id=1706&search_query=test&orderby=blank&order=&wpas=1 but the regular search looks like http://localhost:8888/wordpress/?s=test&submit=Search – Jagst3r15 Dec 5 '13 at 20:49
  • @Jagst3r15 you ask how to force to use a template, and I answered how to force to include a template. If you need the search offered by plugion, whay don't you use that plugin? – gmazzap Dec 5 '13 at 20:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.