Documentation-Issue-Tracker icon indicating copy to clipboard operation
Documentation-Issue-Tracker copied to clipboard

Theme Developer Handbook: Clarify documentation that page-templates folder is not necessary for theme templates

Open carolinan opened this issue 9 months ago • 2 comments

Issue Description

I am moving this from Trac: https://core.trac.wordpress.org/ticket/46490

Hi,

While browsing Page Templates in the Theme Handbook to refresh myself on recommend theme structures and page templates; I became a little confused and suggest some clarification for users.

The File Organization of Page templates section initially confused me because it states "WordPress recognizes the subfolder page-templates." This is misleading and can give readers the impression that WordPress would only recognize that specific folder name.

As of WordPress 3.4, any subdirectory folder can be used (as far as I know).

I suggest rephrasing it something like to be can be placed in any subdirectory but suggest a folder like page->templates or templates. You cannot use a 2nd-level subdirectory (e.g. pages/templates/).

URL of the Page with the Issue

https://developer.wordpress.org/themes/template-files-section/page-template-files/

Section of Page with the issue

Why is this a problem?

Suggested Fix

carolinan avatar Feb 25 '25 09:02 carolinan

Heads up @kafleg @carolinan @TeBenachi - the "themes" label was applied to this issue.

github-actions[bot] avatar Feb 25 '25 09:02 github-actions[bot]

Heads up @WordPress/docs-issues-coordinators, we have a new issue open. Time to use 'em labels.

github-actions[bot] avatar Feb 25 '25 09:02 github-actions[bot]

We can add something like this!?

Page templates can be stored in any first-level subdirectory (e.g., templates/ or page_templates/) of your theme folder. While page-templates/ is a commonly used convention, it's not required. Note: nested subdirectories like pages/templates/ are not supported.

Anuj-Rathore24 avatar Jul 01 '25 13:07 Anuj-Rathore24