mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-04-01 11:14:36 +00:00
Themes: Show templates from both parent and child theme when calling WP_Theme::get_post_templates().
Props birgire for initial patch. Fixes #41717. git-svn-id: https://develop.svn.wordpress.org/trunk@41975 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -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.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user