mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-23 01:27:36 +01:00
Gracefully handle the lack of themes in get_page_templates(). http://mosquito.wordpress.org/view.php?id=1153 Props: donncha
git-svn-id: http://svn.automattic.com/wordpress/trunk@2474 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
e27d276710
commit
9697579316
@ -626,16 +626,18 @@ function get_page_templates() {
|
||||
$templates = $themes[$theme]['Template Files'];
|
||||
$page_templates = array();
|
||||
|
||||
foreach ($templates as $template) {
|
||||
$template_data = implode('', file(ABSPATH . $template));
|
||||
preg_match("|Template Name:(.*)|i", $template_data, $name);
|
||||
preg_match("|Description:(.*)|i", $template_data, $description);
|
||||
if( is_array( $templates ) ) {
|
||||
foreach ($templates as $template) {
|
||||
$template_data = implode('', file(ABSPATH . $template));
|
||||
preg_match("|Template Name:(.*)|i", $template_data, $name);
|
||||
preg_match("|Description:(.*)|i", $template_data, $description);
|
||||
|
||||
$name = $name[1];
|
||||
$description = $description[1];
|
||||
$name = $name[1];
|
||||
$description = $description[1];
|
||||
|
||||
if (! empty($name)) {
|
||||
$page_templates[trim($name)] = basename($template);
|
||||
if (! empty($name)) {
|
||||
$page_templates[trim($name)] = basename($template);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user