Make WordPress Core

Opened 12 years ago

Closed 12 years ago

#23151 closed enhancement (duplicate)

get_attachment_template() doesn't follow the pattern of its get_{type}_template() siblings

Reported by: rulatir's profile rulatir Owned by:
Milestone: Priority: normal
Severity: minor Version: 2.0
Component: Template Keywords: has-patch
Focuses: Cc:

Description

The get_attachment_template() function in template.php is implemented differently from most other get_{type}_template() functions.

Other functions build a list of candidates and pass it to get_query_template(), but get_attachment_template() checks the candidates by itself as it goes, and only calls get_query_template('archive') for the basic case.

I cannot see a reason for this, so I am tentatively filing this as a code quality issue.

(N.b. I am refactoring these functions as part of implementing #23142. In most of them the generation of the candidates list can be trivially factored out with demonstrable correctness, but get_attachment_template() is a harder case due to this inconsistency).

Attachments (1)

23151.patch (976 bytes) - added by SergeyBiryukov 12 years ago.

Download all attachments as: .zip

Change History (6)

#1 @SergeyBiryukov
12 years ago

  • Version changed from 3.5 to 2.0

Introduced as get_subpost_template() in [2958], renamed to get_attachment_template() in [3092].

#2 follow-ups: @SergeyBiryukov
12 years ago

  • Keywords has-patch added
  • Milestone changed from Awaiting Review to 3.6
  • Type changed from defect (bug) to enhancement

#3 in reply to: ↑ 2 @rulatir
12 years ago

[nevermind; in this comment I made an observation that I later found to be incorrect]

Last edited 12 years ago by rulatir (previous) (diff)

#4 in reply to: ↑ 2 @rulatir
12 years ago

Replying to SergeyBiryukov:

Btw. that was the fastest anyone has ever implemented my enhancement request :)

#5 @SergeyBiryukov
12 years ago

  • Milestone 3.6 deleted
  • Resolution set to duplicate
  • Status changed from new to closed

Turned out to be a duplicate of #15337.

Note: See TracTickets for help on using tickets.