• Resolved John Basham

    (@permarad)


    I’m using this code for a dropdown of categories. On selection of the dropdown the desired category is displayed using the archive template. I cannot for the love of me get the template hierarchy to work.

    <form>
    <select name="tag-dropdown" onchange="document.location.href=this.options[this.selectedIndex].value;">
    <option value='#'>Select Taxonomy terms</option>
    <?php $taxonomies = array('service-category');
    $args = array('orderby'=>'name','hide_empty'=>true);
    echo get_terms_dropdown($taxonomies, $args); ?>
    </select>
    </form>

    I am using a custom post type called ‘services’ and a custom taxonomy ‘service-category’. Is there a way to tell the search to use a different archive.php template?

Viewing 3 replies - 1 through 3 (of 3 total)
  • You should be able to create a file called search.php which is what the Template Hierarchy will look for for search results before it defaults to archive.php.

    Thread Starter John Basham

    (@permarad)

    Well it’s not even using the search.php, its going straight to the archive.php. Hence I cannot use a custom template via the template hierarchy. Is there a way within the form to tell the form to use a certain template?

    Thread Starter John Basham

    (@permarad)

    Well I don’t think I ever actually worked out what was causing this hierarchy problem. Probably something to do with my theme.

    I simply customised the archive template and restructured a few things to get my desired setup.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Archive custom template from search’ is closed to new replies.