Opened 12 years ago
Closed 12 years ago
#22847 closed enhancement (wontfix)
Include search.php to archives template hierarchy
Reported by: | alexvorn2 | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 3.4.2 |
Component: | Template | Keywords: | |
Focuses: | Cc: |
Description
If we will use
if( is_archive()) { echo 'test'; }
in the search.php file willget a false result from is_archive function... I think that search file is an archive too because it contains old posts...
Change History (6)
#3
@
12 years ago
Use if ( is_search() )
or use if ( is_archive() or is_search () )
as appropriate for your output. These conditional functions are not tied to the template hierarchy, but to the query object in use.
I believe the request to modify the logic of is_archive() to be invalid.
#4
follow-up:
↓ 5
@
12 years ago
- Keywords close added
in the search.php file willget a false result from is_archive function...
Same as in index.php
(which acts as a fallback if search.php
is missing), so the template isn't actually relevant here. The search results page isn't considered an archive, and changing that may cause backwards compatibility issues.
#5
in reply to:
↑ 4
@
12 years ago
search.php have a lot in common with archives template files: (tag.php, author.php, category.php, etc)
- old posts
- heading in all default themes
- excerpt text
it's just an idea that can make some things more easy to use.. if the search.php file will be missed, archives.php will be used before index.php...
and if function is_search will be available too for backwards compatibility.
I don't think that it's a big change for everyone.
btw, the '2nd-opinion' tag is for added opinion or for waiting for a second opinion? :)
#6
@
12 years ago
- Keywords 2nd-opinion close removed
- Milestone Awaiting Review deleted
- Resolution set to wontfix
- Status changed from new to closed
This change could break many themes because it's not really expected, that is_archive
returns true for a search. Also, a search can include new/current posts too.
I don't think that it's a big change for everyone.
It is.
http://codex.wordpress.org/images/1/18/Template_Hierarchy.png