k-isabelle
5/31/2018 - 4:29 PM

Multiple Search Templates in Wordpress

Multiple Search Templates in Wordpress

// Place this in search.php and create separate templates for each of your searches
// Then add a hidden input "search-type" to your search forms

<?php
if(isset($_GET['search-type'])) {
    $type = $_GET['search-type'];
    if($type == 'normal') {
        load_template(TEMPLATEPATH . '/search-site.php');
    } elseif($type == 'answers') {
        load_template(TEMPLATEPATH . '/search-answers.php');
    }
}
?>