WordPress.org

Make WordPress Core

Opened 9 years ago

Closed 9 years ago

#20435 closed defect (bug) (fixed)

Search result body classes not always applied

Reported by: johnbillion Owned by: ryan
Milestone: 3.4 Priority: normal
Severity: normal Version:
Component: Template Keywords: has-patch commit
Focuses: Cc:

Description

On search results pages a body class of 'search' is applied. This is correctly applied when is_search() is true.

A body class of 'search-results' and 'search-no-results' is also applied according to whether or not there are any results.

However, these two body classes are applied in an else block after a check for is_archive(), so this means if you filter your search results by post type (eg. s=my_search_term&post_type=my_post_type) then the 'search-results' and 'search-no-results' body classes are not applied because is_archive() is true.

Patch coming up.

Attachments (1)

20435.patch (427 bytes) - added by johnbillion 9 years ago.

Download all attachments as: .zip

Change History (4)

@johnbillion
9 years ago

#1 @johnbillion
9 years ago

  • Keywords has-patch added

Patch

#2 @nacin
9 years ago

  • Keywords commit added
  • Milestone changed from Awaiting Review to 3.4

#3 @ryan
9 years ago

  • Owner set to ryan
  • Resolution set to fixed
  • Status changed from new to closed

In [20595]:

Always show search-results or search-no-results for searches, even archive searches. Props johnbillion. fixes #20435

Note: See TracTickets for help on using tickets.