From 8222b85aa221468d332ae0d2b1b57635983480a3 Mon Sep 17 00:00:00 2001 From: Pascal Birchler Date: Mon, 23 Oct 2017 20:08:47 +0000 Subject: [PATCH] Themes: Show templates from both parent and child theme when calling `WP_Theme::get_post_templates()`. Props birgire for initial patch. Fixes #41717. Built from https://develop.svn.wordpress.org/trunk@41975 git-svn-id: http://core.svn.wordpress.org/trunk@41809 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/class-wp-theme.php | 6 +----- wp-includes/version.php | 2 +- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/wp-includes/class-wp-theme.php b/wp-includes/class-wp-theme.php index 4dd0a75016..171d8b6c58 100644 --- a/wp-includes/class-wp-theme.php +++ b/wp-includes/class-wp-theme.php @@ -1036,7 +1036,7 @@ final class WP_Theme implements ArrayAccess { if ( ! is_array( $post_templates ) ) { $post_templates = array(); - $files = (array) $this->get_files( 'php', 1 ); + $files = (array) $this->get_files( 'php', 1, true); foreach ( $files as $file => $full_path ) { if ( ! preg_match( '|Template Name:(.*)$|mi', file_get_contents( $full_path ), $header ) ) { @@ -1091,10 +1091,6 @@ final class WP_Theme implements ArrayAccess { $post_templates = $this->get_post_templates(); $post_templates = isset( $post_templates[ $post_type ] ) ? $post_templates[ $post_type ] : array(); - if ( $this->parent() ) { - $post_templates += $this->parent()->get_page_templates( $post, $post_type ); - } - /** * Filters list of page templates for a theme. * diff --git a/wp-includes/version.php b/wp-includes/version.php index 308a4da932..8d6b1b44b8 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.9-beta3-41974'; +$wp_version = '4.9-beta3-41975'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.