WordPress.org

Make WordPress Core

Opened 2 years ago

Closed 2 years ago

Last modified 2 years ago

#41742 closed enhancement (invalid)

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

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

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

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

#2 @SergeyBiryukov
2 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
2 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 that covers it, yes.

Version 0, edited 2 years ago by danburzo (next)

#4 @SergeyBiryukov
2 years ago

Thanks for the follow-up!

Note: See TracTickets for help on using tickets.