Make WordPress Core

Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#41742 closed enhancement (invalid)

New conditional tag to decide if a post has a custom template

Reported by: danburzo Owned by:
Priority: normal Milestone:
Component: Themes Version: 4.9
Severity: normal Keywords:
Cc: Focuses: template

Description

Something like is_custom_template().

The rationale:

  1. it can be used in template-loader.php to aid in clarifying the Template Hierarchy for attachments, posts, and pages.
  2. in a theme that wants to keep things DRY and redirects all template-xxx.php files to index.php, have a way to enquire if the post has a custom template — this unlocks alternative templating strategies (such as when using Timber).

Change History (4)

#1 @danburzo
9 years ago

  • Resolution → invalid
  • Status new → closed

#2 @SergeyBiryukov
9 years ago

  • Milestone Awaiting Review
  • Type feature request → enhancement

Was the closing intentional?

There are, however, ​is_page_template() and ​get_page_template_slug() functions that should cover this.

#3 @danburzo
9 years ago

@SergeyBiryukov yes, sorry for not leaving a comment along with the closing. I realized in the meantime the is_page_template conditional tag exists, I had somehow missed it in the first place (I think the wording threw me off). I think that covers it, yes.

Last edited 9 years ago by danburzo (previous) (diff)

#4 @SergeyBiryukov
9 years ago

Thanks for the follow-up!

Note: See TracTickets for help on using tickets.