From 80178d8dc85070d73b18b821a22c63bf745c0215 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Thu, 15 Oct 2015 05:10:32 +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. git-svn-id: https://develop.svn.wordpress.org/trunk@35187 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-admin/themes.php | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/wp-admin/themes.php b/src/wp-admin/themes.php index b787d6ce1d..6c5da9fccb 100644 --- a/src/wp-admin/themes.php +++ b/src/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 ); + ?> + +