diff --git wp-admin/includes/class-wp-ms-themes-list-table.php wp-admin/includes/class-wp-ms-themes-list-table.php
index 0f3865a..f2e18b5 100644
|
|
class WP_MS_Themes_List_Table extends WP_List_Table { |
44 | 44 | ) ); |
45 | 45 | |
46 | 46 | $status = isset( $_REQUEST['theme_status'] ) ? $_REQUEST['theme_status'] : 'all'; |
47 | | if ( !in_array( $status, array( 'all', 'enabled', 'disabled', 'upgrade', 'search', 'broken' ) ) ) |
| 47 | if ( !in_array( $status, array( 'all', 'enabled', 'disabled', 'upgrade', 'search', 'broken', 'default' ) ) ) |
48 | 48 | $status = 'all'; |
49 | 49 | |
50 | 50 | $page = $this->get_pagenum(); |
… |
… |
class WP_MS_Themes_List_Table extends WP_List_Table { |
104 | 104 | 'disabled' => array(), |
105 | 105 | 'upgrade' => array(), |
106 | 106 | 'broken' => $this->is_site_themes ? array() : wp_get_themes( array( 'errors' => true ) ), |
| 107 | 'default' => array( wp_get_theme( get_site_option( 'default_theme', WP_DEFAULT_THEME ) ) ), |
107 | 108 | ); |
108 | 109 | |
109 | 110 | if ( $this->is_site_themes ) { |
… |
… |
class WP_MS_Themes_List_Table extends WP_List_Table { |
301 | 302 | case 'broken' : |
302 | 303 | $text = _n( 'Broken <span class="count">(%s)</span>', 'Broken <span class="count">(%s)</span>', $count ); |
303 | 304 | break; |
| 305 | case 'default' : |
| 306 | $text = __( 'Default theme' ) . ' <span class="count">(1)</span>'; |
| 307 | break; |
304 | 308 | } |
305 | 309 | |
306 | 310 | if ( $this->is_site_themes ) |
… |
… |
class WP_MS_Themes_List_Table extends WP_List_Table { |
396 | 400 | 'enable' => '', |
397 | 401 | 'disable' => '', |
398 | 402 | 'edit' => '', |
399 | | 'delete' => '' |
| 403 | 'delete' => '', |
| 404 | 'default' => '', |
400 | 405 | ); |
401 | 406 | |
402 | 407 | $stylesheet = $theme->get_stylesheet(); |
… |
… |
class WP_MS_Themes_List_Table extends WP_List_Table { |
446 | 451 | esc_attr( $aria_label ), |
447 | 452 | ( $this->is_site_themes ? __( 'Disable' ) : __( 'Network Disable' ) ) |
448 | 453 | ); |
| 454 | |
| 455 | // Set default theme raw action |
| 456 | if ( $theme->get_stylesheet() !== get_site_option( 'default_theme', WP_DEFAULT_THEME ) ) { |
| 457 | $url = add_query_arg( array( |
| 458 | 'action' => 'default', |
| 459 | 'theme' => $theme_key, |
| 460 | 'theme_status' => $context, |
| 461 | 'paged' => $page, |
| 462 | 's' => $s, |
| 463 | ), $url ); |
| 464 | |
| 465 | $actions['default'] = sprintf( '<a href="%s" aria-label="%s">%s</a>', |
| 466 | esc_url( wp_nonce_url( $url, 'default-theme_' . $stylesheet ) ), |
| 467 | esc_attr( sprintf( __( 'Set Default Theme %s' ), $theme->display( 'Name' ) ) ), |
| 468 | __( 'Set Default Theme' ) |
| 469 | ); |
| 470 | } |
449 | 471 | } |
450 | 472 | |
451 | 473 | if ( current_user_can('edit_themes') ) { |
… |
… |
class WP_MS_Themes_List_Table extends WP_List_Table { |
643 | 665 | break; |
644 | 666 | |
645 | 667 | case 'name': |
646 | | echo "<td class='theme-title column-primary{$extra_classes}'><strong>" . $item->display('Name') . "</strong>"; |
| 668 | printf( "<td class='theme-title column-primary%s'><strong>%s%s</strong>", |
| 669 | $extra_classes, |
| 670 | $item->display('Name'), |
| 671 | ( $item->get_stylesheet() === $item->network_get_default_theme() ) ? ' - ' . __( 'Default Theme' ) : '' |
| 672 | ); |
647 | 673 | |
648 | 674 | $this->column_name( $item ); |
649 | 675 | |
diff --git wp-admin/includes/schema.php wp-admin/includes/schema.php
index cd66e19..aa2a1f7 100644
|
|
function populate_options() { |
365 | 365 | $uploads_use_yearmonth_folders = 1; |
366 | 366 | } |
367 | 367 | |
368 | | // If WP_DEFAULT_THEME doesn't exist, fall back to the latest core default theme. |
369 | 368 | $stylesheet = $template = WP_DEFAULT_THEME; |
370 | | $theme = wp_get_theme( WP_DEFAULT_THEME ); |
371 | | if ( ! $theme->exists() ) { |
372 | | $theme = WP_Theme::get_core_default_theme(); |
| 369 | |
| 370 | // If it's multisite and WP_DEFAULT_THEME is not redifined in WP Config, get the network default theme |
| 371 | if ( is_multisite() ) { |
| 372 | $default_theme = get_network_option( get_current_network_id(),'default_theme', false ); |
| 373 | |
| 374 | if ( ! empty( $default_theme ) ) { |
| 375 | $theme = wp_get_theme( $default_theme ); |
| 376 | if ( $theme->exists() ) { |
| 377 | $stylesheet = $theme->get_stylesheet(); |
| 378 | $template = $theme->get_template(); |
| 379 | } |
| 380 | } |
| 381 | } |
| 382 | |
| 383 | if ( empty ( $theme ) || ! $theme->exists() ) { |
| 384 | $theme = wp_get_theme( WP_DEFAULT_THEME ); |
| 385 | |
| 386 | if ( ! $theme->exists() ) { |
| 387 | $theme = WP_Theme::get_core_default_theme(); |
| 388 | } |
373 | 389 | } |
374 | 390 | |
375 | 391 | // If we can't find a core default theme, WP_DEFAULT_THEME is the best we can do. |
diff --git wp-admin/network/settings.php wp-admin/network/settings.php
index 5d81cdf..4646cf3 100644
|
|
if ( isset( $_GET['updated'] ) ) { |
202 | 202 | </table> |
203 | 203 | <h2><?php _e( 'New Site Settings' ); ?></h2> |
204 | 204 | <table class="form-table"> |
205 | | |
206 | 205 | <tr> |
207 | 206 | <th scope="row"><label for="welcome_email"><?php _e( 'Welcome Email' ) ?></label></th> |
208 | 207 | <td> |
diff --git wp-admin/network/themes.php wp-admin/network/themes.php
index 2b22847..c04050a 100644
|
|
if ( $action ) { |
40 | 40 | WP_Theme::network_disable_theme( $_GET['theme'] ); |
41 | 41 | wp_safe_redirect( add_query_arg( 'disabled', '1', $referer ) ); |
42 | 42 | exit; |
| 43 | case 'default': |
| 44 | check_admin_referer('default-theme_' . $_GET['theme']); |
| 45 | WP_Theme::network_set_default_theme( $_GET['theme'] ); |
| 46 | wp_safe_redirect( add_query_arg( 'default', '1', $referer ) ); |
| 47 | exit; |
43 | 48 | case 'enable-selected': |
44 | 49 | check_admin_referer('bulk-themes'); |
45 | 50 | $themes = isset( $_POST['checked'] ) ? (array) $_POST['checked'] : array(); |
… |
… |
if ( isset( $_GET['enabled'] ) ) { |
287 | 292 | $message = _n( '%s theme deleted.', '%s themes deleted.', $deleted ); |
288 | 293 | } |
289 | 294 | echo '<div id="message" class="updated notice is-dismissible"><p>' . sprintf( $message, number_format_i18n( $deleted ) ) . '</p></div>'; |
| 295 | } elseif ( isset( $_GET['default'] ) ) { |
| 296 | $message = __( 'Default theme has been set.' ); |
| 297 | echo '<div id="message" class="updated notice is-dismissible"><p>' . $message . '</p></div>'; |
290 | 298 | } elseif ( isset( $_GET['error'] ) && 'none' == $_GET['error'] ) { |
291 | 299 | echo '<div id="message" class="error notice is-dismissible"><p>' . __( 'No theme selected.' ) . '</p></div>'; |
292 | 300 | } elseif ( isset( $_GET['error'] ) && 'main' == $_GET['error'] ) { |
diff --git wp-includes/class-wp-theme.php wp-includes/class-wp-theme.php
index f161a63..18e540c 100644
|
|
final class WP_Theme implements ArrayAccess { |
1431 | 1431 | } |
1432 | 1432 | |
1433 | 1433 | /** |
| 1434 | * Set the network default theme. |
| 1435 | * |
| 1436 | * @since 4.8.0 |
| 1437 | * @access public |
| 1438 | * @static |
| 1439 | * |
| 1440 | * @param string $stylesheet name. |
| 1441 | */ |
| 1442 | public static function network_set_default_theme( $stylesheet ) { |
| 1443 | if ( ! is_multisite() ) { |
| 1444 | return false; |
| 1445 | } |
| 1446 | |
| 1447 | $theme = wp_get_theme( $stylesheet ); |
| 1448 | if ( ! $theme->exists() ) { |
| 1449 | return false; |
| 1450 | } |
| 1451 | |
| 1452 | if ( ! $theme->is_allowed() ) { |
| 1453 | return false; |
| 1454 | } |
| 1455 | |
| 1456 | update_network_option( get_current_network_id(), 'default_theme', $stylesheet ); |
| 1457 | } |
| 1458 | |
| 1459 | /** |
| 1460 | * Get the network default theme. |
| 1461 | * |
| 1462 | * @since 4.8.0 |
| 1463 | * @access public |
| 1464 | * @static |
| 1465 | */ |
| 1466 | public static function network_get_default_theme() { |
| 1467 | return get_network_option( get_current_network_id(), 'default_theme', WP_DEFAULT_THEME ); |
| 1468 | } |
| 1469 | |
| 1470 | /** |
1434 | 1471 | * Sorts themes by name. |
1435 | 1472 | * |
1436 | 1473 | * @since 3.4.0 |