Make WordPress Core

Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#41665 closed defect (bug) (invalid)

Theme Parent Templates Missing From Metabox: page-attributes

Reported by: michaelecklund's profile michael.ecklund Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.8.1
Component: Themes Keywords:
Focuses: ui, administration Cc:

Description

I have two themes.

Parent Theme and Child Theme.

Child Theme is the active theme.

As per the Theme Developer Handbook, Creating Custom Page Templates for Global Use.

I've defined a simple page template to be used globally like so:

<?php

/**
 * Template Name: One Column
 */

// ....

?>

The above code is placed into a file called one-column.php and for simplicity, placed into the theme root directory of the parent theme.

When I edit a page in the backend, the page-attributes metabox has no option for a drop down menu at all. Yet, clearly I have a page template defined in the parent theme. It should be showing up, shouldn't it?

Now... If I take the same exact page template file and move it into the root directory of the active child theme, and edit a page in the backend, the page-attributes metabox suddenly has a dropdown menu containing my page template (as expected).

My question is, why are page templates defined in the parent theme of the active child theme completely ignored?

Now to further test my point even more. Leave the one-column.php file in the root directory of the active child theme and add another page template file called two-columns.php and place this file into the root directory of the parent theme.

Contents of two-columns.php:

<?php

/**
 * Template Name: Two Columns
 */

// ....

?>

Edit a page, and take a gander at the dropdown menu in the page-attributes metabox. You will only see the page template of "One Column" as defined by one-column.php in the root directory of the active child theme. You will not see "Two Columns" as defined by two-columns.php defined in the root directory of the parent theme.


Potential Start on Tracing/Debugging:

./wp-admin/includes/meta-boxes.php Line 865
./wp-admin/includes/template.php Line 771
./wp-admin/includes/theme.php Line 112

Attachments (1)

templates.gif (72.8 KB) - added by jcastaneda 7 years ago.

Download all attachments as: .zip

Change History (8)

This ticket was mentioned in Slack in #core-themes by michael.ecklund. View the logs.


7 years ago

#2 @sami.keijonen
7 years ago

I tested this in my local environment but could not re-create the issue. I'm pretty sure there is some small theme specific issue or plugin conflict.

@jcastaneda
7 years ago

#3 @jcastaneda
7 years ago

I tried to replicate the issue but I can't. I used Twenty Seventeen with an active child theme. The child theme was just a CSS file. The only active plugins were Query Monitor and BuddyPress.

Are there any active plugins?

#4 @Soean
7 years ago

  • Keywords reporter-feedback added

#5 @michael.ecklund
7 years ago

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

#6 @SergeyBiryukov
7 years ago

  • Milestone Awaiting Review deleted

#7 @SergeyBiryukov
7 years ago

  • Keywords reporter-feedback removed
Note: See TracTickets for help on using tickets.