Make WordPress Core

Opened 14 years ago

Closed 14 years ago

#17788 closed enhancement (duplicate)

get_query_template() global filter

Reported by: 5ubliminal's profile 5ubliminal Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.2
Component: Template Keywords: has-patch
Focuses: Cc:

Description (last modified by scribu)

My implementation has two parameters ($type also):

is_array( $new_templates = apply_filters( "query_template", $templates, $type ) ) and
	!empty( $new_templates ) and ( $templates = $new_templates );

Plus it validates the result. If it's not an array it reverts to original.

I'd say a bit better than the 11 MONTHS (OMG): #14310

Thanks.

Attachments (1)

get_query_template-filter.patch (705 bytes) - added by 5ubliminal 14 years ago.
The improvement.

Download all attachments as: .zip

Change History (4)

@5ubliminal
14 years ago

The improvement.

#1 @scribu
14 years ago

  • Description modified (diff)

#2 @scribu
14 years ago

  • Keywords has-patch added

Note this section of the coding standards:

http://codex.wordpress.org/WordPress_Coding_Standards#Clever_Code

Could you describe why your approach is better?

#3 @scribu
14 years ago

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

I mean, it boils down to this:

apply_filters( "{$type}_template_hierarchy", $templates );

vs.

apply_filters( "template_hierarchy", $templates, $type );

Since it addresses the same problem, I'm going to close it as a duplicate (should have been more explicit when I suggested you look at the other ticket).

Feel free to comment either here or on the other ticket.

Note: See TracTickets for help on using tickets.