mirror of
https://github.com/WordPress/WordPress.git
synced 2024-09-27 06:42:56 +02:00
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
This commit is contained in:
parent
5cebd10ced
commit
09ee95ea49
@ -300,6 +300,7 @@ if ( ! is_multisite() && current_user_can('edit_themes') && $broken_themes = wp_
|
||||
|
||||
<?php
|
||||
$can_delete = current_user_can( 'delete_themes' );
|
||||
$can_install = current_user_can( 'install_themes' );
|
||||
?>
|
||||
<table>
|
||||
<tr>
|
||||
@ -308,6 +309,9 @@ $can_delete = current_user_can( 'delete_themes' );
|
||||
<?php if ( $can_delete ) { ?>
|
||||
<td></td>
|
||||
<?php } ?>
|
||||
<?php if ( $can_install ) { ?>
|
||||
<td></td>
|
||||
<?php } ?>
|
||||
</tr>
|
||||
<?php foreach ( $broken_themes as $broken_theme ) : ?>
|
||||
<tr>
|
||||
@ -325,6 +329,22 @@ $can_delete = current_user_can( 'delete_themes' );
|
||||
<td><a href="<?php echo esc_url( $delete_url ); ?>" class="button button-secondary delete-theme"><?php _e( 'Delete' ); ?></a></td>
|
||||
<?php
|
||||
}
|
||||
|
||||
if ( $can_install && 'theme_no_parent' === $broken_theme->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 );
|
||||
?>
|
||||
<td><a href="<?php echo esc_url( $install_url ); ?>" class="button button-secondary install-theme"><?php _e( 'Install Parent Theme' ); ?></a></td>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
?>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
|
@ -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.
|
||||
|
Loading…
Reference in New Issue
Block a user