WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Search results not using archive.php (5 posts)

  1. kccricket
    Member
    Posted 9 years ago #

    I'm creating a personal theme based on the code and markup (but not the CSS) from the WordPress default theme. According to Template Hierarchy in the Codex, archive.php will be used if search.php doesn't exist. Based on this information, I deleted search.php since default's archive.php has an 'if' statement for search results.

    Unfortunately, it doesn't seem to work that way. If I perform a search in the blog, it is definitely using index.php instead of archive.php. Feel free to try it yourself. Search for "lorem", and it brings you to a page with "Announcements" as the second header. archive.php does not contain a h2 that just says "Announcements." It should read "Search Results."

    Is the Codex wrong or is there likely something wrong with my setup?

  2. Joshua Sigar
    Member
    Posted 9 years ago #

    Codex is wrong. Search view will try to load search.php and then index.php.

    I just updated the codex, by the way.

  3. Beel
    Member
    Posted 9 years ago #

    Edit: missed it, you win.

  4. kccricket
    Member
    Posted 9 years ago #

    Roger that. Is it planned to work the "wrong" way eventually, or was the misprint just a misprint?

  5. Joshua Sigar
    Member
    Posted 9 years ago #

    It will work as how it is right now, unless you complain enough (read: submit a bug) that search view has to load archive.php before index.php

    It was just misdocumentation, by the way. I suppose, because we wrote the docs after the software built.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.