Make WordPress Core

Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#41742 closed enhancement (invalid)

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

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


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
6 years ago

  • Resolution set to invalid
  • Status changed from new to closed

#2 @SergeyBiryukov
6 years ago

  • Milestone Awaiting Review deleted
  • Type changed from feature request to enhancement

Was the closing intentional?

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

#3 @danburzo
6 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 6 years ago by danburzo (previous) (diff)

#4 @SergeyBiryukov
6 years ago

Thanks for the follow-up!

Note: See TracTickets for help on using tickets.