Make WordPress Core

Opened 3 months ago

Last modified 3 weeks ago

#61210 new defect (bug)

Custom Template Not working

Reported by: nkpathan's profile nkpathan Owned by:
Milestone: 6.7 Priority: normal
Severity: normal Version: 6.5.3
Component: Editor Keywords: dev-feedback
Focuses: Cc:

Description

Hello,

In WordPress 6.5.3 twentytwentyfour.

We have created Template page but custom template page not woking and not showing under Page attributes .

It shows on Page List page.

Please check on it.

Thanks

Attachments (3)

template_code_file.png (7.5 KB) - added by nkpathan 3 months ago.
Template Code File
pageBackEnd.png (23.8 KB) - added by nkpathan 3 months ago.
Page Backend
Page List View.png (49.4 KB) - added by nkpathan 3 months ago.
Page List View

Download all attachments as: .zip

Change History (8)

@nkpathan
3 months ago

Template Code File

@nkpathan
3 months ago

Page Backend

@nkpathan
3 months ago

Page List View

#1 @jpolakovic
2 months ago

+1 – the Page Template selector is missing from the Editor screen in WP 6.5.3.

This is a major regression making the usage of the legacy PHP templates confusing in block themes. For now the only way of choosing a legacy Page template is through Quick Edit.

#2 @bvankat
2 months ago

+1 - Same experience here. And I've recreated this in the WordPress Playground.

Started by uploading a modified version of the TT4 theme that included a php post template — in this case, template is called "Weekly Newsletter." Filename is "template-weekly-newsletter.php", and stored at the root level of the theme folder. (FWIW, same behavior if the php template is stored in the theme's "templates" directory.)

In 6.4, the post editor shows a dropdown menu when switching templates. This dropdown menu shows the name of all available templates, including php and html templates. (The php template can also be selected in the posts list page via Quick Edit.)

In 6.5.3, the template switcher has options for Edit Template, Swap Template, Create New Template and Template Preview. When selecting "Swap Template" a modal opens with the available choices. This modal does *not* include PHP templates, only html templates. As mentioned earlier in this thread, the only way to select the php template is via the Quick Edit option on the Posts list page.

Additionally in 6.5.3: Once the *php* template is selected via Quick Edit, the post editor no longer shows the Template switcher in the post settings. At that point, the template can only be changed via Quick Edit until you select an html template again.

#3 @poena
2 months ago

  • Component changed from Themes to Editor
  • Keywords dev-feedback added

Hi
Thank you for the report and the additional information.

To summarize: PHP template files in hybrid themes do not show up as selectable templates when you open a page in the page editor and select the option "Swap template".

Looking back at Gutenberg issues and PR's, the implementation of this "swap template" feature started a year ago, and it may be difficult to recall if there was a conscious decision not to support PHP templates, but it is very likely that this was missed because this started out as a Site Editor feature, where only HTML templates can be used:
https://github.com/WordPress/gutenberg/issues/51347
This may be a side effect of the unification of the Site Editor and block editor.

I am going to ping @youknowriad @Mamaduka who recently worked on a similar issue with custom template swapping (https://github.com/WordPress/gutenberg/issues/61031).

This problem is not an issue in WordPress 6.4 since the template selection used a dropdown where the PHP template was listed, so it is a regression.

I would also suggest that this issue is closed and re-opened in the Gutenberg GitHub repository since this is a problem related to the editor.

I can confirm that

  • I am able to reproduce the problem.
  • No templates are listed under the "page attributes" panel, and this is correct. The page template selection has moved multiple times. The location of the template selection is not visible in the "page backend" screenshot that have been shared here, but this is not a bug, but a change in the interface.
  • The correct place for the PHP template files in a hybrid theme is the root folder.

#4 @Mamaduka
2 months ago

My general fix hasn't been merged yet, #61110, but I think this is a different issue.

@fabiankaegy, you worked on fixing the template selection for classic themes. Does it also cover the hybrid themes?

#5 @poena
3 weeks ago

  • Milestone changed from Awaiting Review to 6.7

This is still a problem using 6.6 RC2. How can we work towards solving this in Gutenberg and 6.7?
@youknowriad @fabiankaegy

Note: See TracTickets for help on using tickets.