Make WordPress Core

Opened 14 years ago

Closed 11 years ago

#23202 closed defect (bug) (wontfix)

Enable is_page_template() within the Loop

Reported by: wpsmith Owned by:
Priority: normal Milestone:
Component: Posts, Post Types Version:
Severity: normal Keywords: has-patch reporter-feedback
Cc: Focuses: template

Description

There have been a few times where, in the loop, I need to know if I were on a page using a specific page template.

The function in_the_loop() provides this functionality for us to expand is_page_template().

Attachments (2)

23202.patch (779 bytes ) - added by wpsmith 14 years ago.
23202.alt.patch (1.1 KB ) - added by wpsmith 13 years ago.
Alternative solution

Download all attachments as: .zip

Change History (8)

@wpsmith
14 years ago

#1 @alexvorn2
14 years ago

  • Component GeneralTemplate

#2 @wpsmith
14 years ago

  • Keywords has-patch dev-feedback added

@wpsmith
13 years ago

Alternative solution

#3 @nacin
13 years ago

  • Component TemplatePosts, Post Types
  • Focuses template added

#4 @nacin
12 years ago

Unless I'm reading this wrong, it seems like the issue here is the usage of query_posts(). query_posts() does change the active $wp_query and thus all conditionals.

This should work fine if you're on a page with a page template inside a loop. But *the* loop doesn't really make any sense as that should be the actual page (singular).

Alternatively, if it's proposing that it should work inside the loop for the current page: I think this would break things by changing the return value. While can take a function and make it work outside of the loop, taking a function and changing its behavior inside the loop is gonna cause problems.

Maybe I just don't understand the problem.

#5 @obenland
12 years ago

  • Keywords reporter-feedback added; dev-feedback removed

Travis, would you mind elaborating the use case?

#6 @wonderboymusic
11 years ago

  • Milestone Awaiting Review
  • Resolutionwontfix
  • Status newclosed

No response in a year.

Note: See TracTickets for help on using tickets.