From 09ee95ea49e7255a21ffcac8d40672a53d7412a0 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Thu, 15 Oct 2015 05:11:24 +0000 Subject: [PATCH] Themes: Add Install Parent Theme button for child themes that are missing a parent theme. Props rabmalin for initial patch. Fixes #32668. Built from https://develop.svn.wordpress.org/trunk@35187 git-svn-id: http://core.svn.wordpress.org/trunk@35153 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/themes.php | 20 ++++++++++++++++++++ wp-includes/version.php | 2 +- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/wp-admin/themes.php b/wp-admin/themes.php index b787d6ce1d..6c5da9fccb 100644 --- a/wp-admin/themes.php +++ b/wp-admin/themes.php @@ -300,6 +300,7 @@ if ( ! is_multisite() && current_user_can('edit_themes') && $broken_themes = wp_ @@ -308,6 +309,9 @@ $can_delete = current_user_can( 'delete_themes' ); + + + @@ -325,6 +329,22 @@ $can_delete = current_user_can( 'delete_themes' ); errors()->get_error_code() ) { + $parent_theme_name = $broken_theme->get( 'Template' ); + $parent_theme = themes_api( 'theme_information', array( 'slug' => urlencode( $parent_theme_name ) ) ); + + if ( ! is_wp_error( $parent_theme ) ) { + $install_url = add_query_arg( array( + 'action' => 'install-theme', + 'theme' => urlencode( $parent_theme_name ), + ), admin_url( 'update.php' ) ); + $install_url = wp_nonce_url( $install_url, 'install-theme_' . $parent_theme_name ); + ?> + + diff --git a/wp-includes/version.php b/wp-includes/version.php index 5ae1323863..0b32cce93a 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.4-alpha-35186'; +$wp_version = '4.4-alpha-35187'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.