248 |
249 |
249 <div class="wrap"> |
250 <div class="wrap"> |
250 <h1 class="wp-heading-inline"><?php esc_html_e( 'Themes' ); ?> |
251 <h1 class="wp-heading-inline"><?php esc_html_e( 'Themes' ); ?> |
251 <span class="title-count theme-count"><?php echo ! empty( $_GET['search'] ) ? __( '…' ) : count( $themes ); ?></span> |
252 <span class="title-count theme-count"><?php echo ! empty( $_GET['search'] ) ? __( '…' ) : count( $themes ); ?></span> |
252 </h1> |
253 </h1> |
253 |
|
254 <?php if ( ! is_multisite() && current_user_can( 'install_themes' ) ) : ?> |
254 <?php if ( ! is_multisite() && current_user_can( 'install_themes' ) ) : ?> |
255 <a href="<?php echo esc_url( admin_url( 'theme-install.php' ) ); ?>" class="hide-if-no-js page-title-action"><?php echo esc_html_x( 'Add New', 'theme' ); ?></a> |
255 <a href="<?php echo esc_url( admin_url( 'theme-install.php' ) ); ?>" class="hide-if-no-js page-title-action"><?php echo esc_html__( 'Add New Theme' ); ?></a> |
256 <?php endif; ?> |
256 <?php endif; ?> |
257 |
|
258 <form class="search-form"></form> |
|
259 |
|
260 <hr class="wp-header-end"> |
257 <hr class="wp-header-end"> |
|
258 <form class="search-form search-themes"><p class="search-box"></p></form> |
|
259 |
261 <?php |
260 <?php |
262 if ( ! validate_current_theme() || isset( $_GET['broken'] ) ) { |
261 if ( ! validate_current_theme() || isset( $_GET['broken'] ) ) { |
263 ?> |
262 wp_admin_notice( |
264 <div id="message1" class="updated notice is-dismissible"><p><?php _e( 'The active theme is broken. Reverting to the default theme.' ); ?></p></div> |
263 __( 'The active theme is broken. Reverting to the default theme.' ), |
265 <?php |
264 array( |
|
265 'id' => 'message1', |
|
266 'additional_classes' => array( 'updated' ), |
|
267 'dismissible' => true, |
|
268 ) |
|
269 ); |
266 } elseif ( isset( $_GET['activated'] ) ) { |
270 } elseif ( isset( $_GET['activated'] ) ) { |
267 if ( isset( $_GET['previewed'] ) ) { |
271 if ( isset( $_GET['previewed'] ) ) { |
268 ?> |
272 wp_admin_notice( |
269 <div id="message2" class="updated notice is-dismissible"><p><?php _e( 'Settings saved and theme activated.' ); ?> <a href="<?php echo home_url( '/' ); ?>"><?php _e( 'Visit site' ); ?></a></p></div> |
273 __( 'Settings saved and theme activated.' ) . ' <a href="' . esc_url( home_url( '/' ) ) . '">' . __( 'Visit site' ) . '</a>', |
270 <?php |
274 array( |
|
275 'id' => 'message2', |
|
276 'additional_classes' => array( 'updated' ), |
|
277 'dismissible' => true, |
|
278 ) |
|
279 ); |
271 } else { |
280 } else { |
272 ?> |
281 wp_admin_notice( |
273 <div id="message2" class="updated notice is-dismissible"><p><?php _e( 'New theme activated.' ); ?> <a href="<?php echo home_url( '/' ); ?>"><?php _e( 'Visit site' ); ?></a></p></div> |
282 __( 'New theme activated.' ) . ' <a href="' . esc_url( home_url( '/' ) ) . '">' . __( 'Visit site' ) . '</a>', |
274 <?php |
283 array( |
|
284 'id' => 'message2', |
|
285 'additional_classes' => array( 'updated' ), |
|
286 'dismissible' => true, |
|
287 ) |
|
288 ); |
275 } |
289 } |
276 } elseif ( isset( $_GET['deleted'] ) ) { |
290 } elseif ( isset( $_GET['deleted'] ) ) { |
277 ?> |
291 wp_admin_notice( |
278 <div id="message3" class="updated notice is-dismissible"><p><?php _e( 'Theme deleted.' ); ?></p></div> |
292 __( 'Theme deleted.' ), |
279 <?php |
293 array( |
|
294 'id' => 'message3', |
|
295 'additional_classes' => array( 'updated' ), |
|
296 'dismissible' => true, |
|
297 ) |
|
298 ); |
280 } elseif ( isset( $_GET['delete-active-child'] ) ) { |
299 } elseif ( isset( $_GET['delete-active-child'] ) ) { |
281 ?> |
300 wp_admin_notice( |
282 <div id="message4" class="error"><p><?php _e( 'You cannot delete a theme while it has an active child theme.' ); ?></p></div> |
301 __( 'You cannot delete a theme while it has an active child theme.' ), |
283 <?php |
302 array( |
|
303 'id' => 'message4', |
|
304 'additional_classes' => array( 'error' ), |
|
305 ) |
|
306 ); |
284 } elseif ( isset( $_GET['resumed'] ) ) { |
307 } elseif ( isset( $_GET['resumed'] ) ) { |
285 ?> |
308 wp_admin_notice( |
286 <div id="message5" class="updated notice is-dismissible"><p><?php _e( 'Theme resumed.' ); ?></p></div> |
309 __( 'Theme resumed.' ), |
287 <?php |
310 array( |
|
311 'id' => 'message5', |
|
312 'additional_classes' => array( 'updated' ), |
|
313 'dismissible' => true, |
|
314 ) |
|
315 ); |
288 } elseif ( isset( $_GET['error'] ) && 'resuming' === $_GET['error'] ) { |
316 } elseif ( isset( $_GET['error'] ) && 'resuming' === $_GET['error'] ) { |
289 ?> |
317 wp_admin_notice( |
290 <div id="message6" class="error"><p><?php _e( 'Theme could not be resumed because it triggered a <strong>fatal error</strong>.' ); ?></p></div> |
318 __( 'Theme could not be resumed because it triggered a <strong>fatal error</strong>.' ), |
291 <?php |
319 array( |
|
320 'id' => 'message6', |
|
321 'additional_classes' => array( 'error' ), |
|
322 ) |
|
323 ); |
292 } elseif ( isset( $_GET['enabled-auto-update'] ) ) { |
324 } elseif ( isset( $_GET['enabled-auto-update'] ) ) { |
293 ?> |
325 wp_admin_notice( |
294 <div id="message7" class="updated notice is-dismissible"><p><?php _e( 'Theme will be auto-updated.' ); ?></p></div> |
326 __( 'Theme will be auto-updated.' ), |
295 <?php |
327 array( |
|
328 'id' => 'message7', |
|
329 'additional_classes' => array( 'updated' ), |
|
330 'dismissible' => true, |
|
331 ) |
|
332 ); |
296 } elseif ( isset( $_GET['disabled-auto-update'] ) ) { |
333 } elseif ( isset( $_GET['disabled-auto-update'] ) ) { |
297 ?> |
334 wp_admin_notice( |
298 <div id="message8" class="updated notice is-dismissible"><p><?php _e( 'Theme will no longer be auto-updated.' ); ?></p></div> |
335 __( 'Theme will no longer be auto-updated.' ), |
299 <?php |
336 array( |
|
337 'id' => 'message8', |
|
338 'additional_classes' => array( 'updated' ), |
|
339 'dismissible' => true, |
|
340 ) |
|
341 ); |
300 } |
342 } |
301 |
343 |
302 $current_theme = wp_get_theme(); |
344 $current_theme = wp_get_theme(); |
303 |
345 |
304 if ( $current_theme->errors() && ( ! is_multisite() || current_user_can( 'manage_network_themes' ) ) ) { |
346 if ( $current_theme->errors() && ( ! is_multisite() || current_user_can( 'manage_network_themes' ) ) ) { |
305 echo '<div class="error"><p>' . __( 'Error:' ) . ' ' . $current_theme->errors()->get_error_message() . '</p></div>'; |
347 wp_admin_notice( |
|
348 __( 'Error:' ) . ' ' . $current_theme->errors()->get_error_message(), |
|
349 array( |
|
350 'additional_classes' => array( 'error' ), |
|
351 ) |
|
352 ); |
306 } |
353 } |
307 |
354 |
308 $current_theme_actions = array(); |
355 $current_theme_actions = array(); |
309 |
356 |
310 if ( is_array( $submenu ) && isset( $submenu['themes.php'] ) ) { |
357 if ( is_array( $submenu ) && isset( $submenu['themes.php'] ) ) { |
393 <?php } else { ?> |
440 <?php } else { ?> |
394 <div class="theme-screenshot blank"></div> |
441 <div class="theme-screenshot blank"></div> |
395 <?php } ?> |
442 <?php } ?> |
396 |
443 |
397 <?php if ( $theme['hasUpdate'] ) : ?> |
444 <?php if ( $theme['hasUpdate'] ) : ?> |
398 <?php if ( $theme['updateResponse']['compatibleWP'] && $theme['updateResponse']['compatiblePHP'] ) : ?> |
445 <?php |
399 <div class="update-message notice inline notice-warning notice-alt"><p> |
446 if ( $theme['updateResponse']['compatibleWP'] && $theme['updateResponse']['compatiblePHP'] ) : |
400 <?php if ( $theme['hasPackage'] ) : ?> |
447 if ( $theme['hasPackage'] ) { |
401 <?php _e( 'New version available. <button class="button-link" type="button">Update now</button>' ); ?> |
448 $new_version_available = __( 'New version available. <button class="button-link" type="button">Update now</button>' ); |
402 <?php else : ?> |
449 } else { |
403 <?php _e( 'New version available.' ); ?> |
450 $new_version_available = __( 'New version available.' ); |
404 <?php endif; ?> |
451 } |
405 </p></div> |
452 wp_admin_notice( |
406 <?php else : ?> |
453 $new_version_available, |
407 <div class="update-message notice inline notice-error notice-alt"><p> |
454 array( |
408 <?php |
455 'type' => 'warning', |
409 if ( ! $theme['updateResponse']['compatibleWP'] && ! $theme['updateResponse']['compatiblePHP'] ) { |
456 'additional_classes' => array( 'notice-alt', 'inline', 'update-message' ), |
410 printf( |
457 ) |
411 /* translators: %s: Theme name. */ |
458 ); |
412 __( 'There is a new version of %s available, but it does not work with your versions of WordPress and PHP.' ), |
459 else : |
413 $theme['name'] |
460 $theme_update_error = ''; |
414 ); |
461 if ( ! $theme['updateResponse']['compatibleWP'] && ! $theme['updateResponse']['compatiblePHP'] ) { |
415 if ( current_user_can( 'update_core' ) && current_user_can( 'update_php' ) ) { |
462 $theme_update_error .= sprintf( |
416 printf( |
463 /* translators: %s: Theme name. */ |
417 /* translators: 1: URL to WordPress Updates screen, 2: URL to Update PHP page. */ |
464 __( 'There is a new version of %s available, but it does not work with your versions of WordPress and PHP.' ), |
418 ' ' . __( '<a href="%1$s">Please update WordPress</a>, and then <a href="%2$s">learn more about updating PHP</a>.' ), |
465 $theme['name'] |
419 self_admin_url( 'update-core.php' ), |
466 ); |
420 esc_url( wp_get_update_php_url() ) |
467 if ( current_user_can( 'update_core' ) && current_user_can( 'update_php' ) ) { |
421 ); |
468 $theme_update_error .= sprintf( |
422 wp_update_php_annotation( '</p><p><em>', '</em>' ); |
469 /* translators: 1: URL to WordPress Updates screen, 2: URL to Update PHP page. */ |
423 } elseif ( current_user_can( 'update_core' ) ) { |
470 ' ' . __( '<a href="%1$s">Please update WordPress</a>, and then <a href="%2$s">learn more about updating PHP</a>.' ), |
424 printf( |
471 self_admin_url( 'update-core.php' ), |
425 /* translators: %s: URL to WordPress Updates screen. */ |
472 esc_url( wp_get_update_php_url() ) |
426 ' ' . __( '<a href="%s">Please update WordPress</a>.' ), |
473 ); |
427 self_admin_url( 'update-core.php' ) |
474 wp_update_php_annotation( '</p><p><em>', '</em>', false ); |
428 ); |
475 } elseif ( current_user_can( 'update_core' ) ) { |
429 } elseif ( current_user_can( 'update_php' ) ) { |
476 $theme_update_error .= sprintf( |
430 printf( |
477 /* translators: %s: URL to WordPress Updates screen. */ |
431 /* translators: %s: URL to Update PHP page. */ |
478 ' ' . __( '<a href="%s">Please update WordPress</a>.' ), |
432 ' ' . __( '<a href="%s">Learn more about updating PHP</a>.' ), |
479 self_admin_url( 'update-core.php' ) |
433 esc_url( wp_get_update_php_url() ) |
480 ); |
434 ); |
481 } elseif ( current_user_can( 'update_php' ) ) { |
435 wp_update_php_annotation( '</p><p><em>', '</em>' ); |
482 $theme_update_error .= sprintf( |
436 } |
483 /* translators: %s: URL to Update PHP page. */ |
437 } elseif ( ! $theme['updateResponse']['compatibleWP'] ) { |
484 ' ' . __( '<a href="%s">Learn more about updating PHP</a>.' ), |
438 printf( |
485 esc_url( wp_get_update_php_url() ) |
439 /* translators: %s: Theme name. */ |
486 ); |
440 __( 'There is a new version of %s available, but it does not work with your version of WordPress.' ), |
487 wp_update_php_annotation( '</p><p><em>', '</em>', false ); |
441 $theme['name'] |
|
442 ); |
|
443 if ( current_user_can( 'update_core' ) ) { |
|
444 printf( |
|
445 /* translators: %s: URL to WordPress Updates screen. */ |
|
446 ' ' . __( '<a href="%s">Please update WordPress</a>.' ), |
|
447 self_admin_url( 'update-core.php' ) |
|
448 ); |
|
449 } |
|
450 } elseif ( ! $theme['updateResponse']['compatiblePHP'] ) { |
|
451 printf( |
|
452 /* translators: %s: Theme name. */ |
|
453 __( 'There is a new version of %s available, but it does not work with your version of PHP.' ), |
|
454 $theme['name'] |
|
455 ); |
|
456 if ( current_user_can( 'update_php' ) ) { |
|
457 printf( |
|
458 /* translators: %s: URL to Update PHP page. */ |
|
459 ' ' . __( '<a href="%s">Learn more about updating PHP</a>.' ), |
|
460 esc_url( wp_get_update_php_url() ) |
|
461 ); |
|
462 wp_update_php_annotation( '</p><p><em>', '</em>' ); |
|
463 } |
|
464 } |
488 } |
465 ?> |
489 } elseif ( ! $theme['updateResponse']['compatibleWP'] ) { |
466 </p></div> |
490 $theme_update_error .= sprintf( |
467 <?php endif; ?> |
491 /* translators: %s: Theme name. */ |
468 <?php endif; ?> |
492 __( 'There is a new version of %s available, but it does not work with your version of WordPress.' ), |
469 |
493 $theme['name'] |
470 <?php |
494 ); |
|
495 if ( current_user_can( 'update_core' ) ) { |
|
496 $theme_update_error .= sprintf( |
|
497 /* translators: %s: URL to WordPress Updates screen. */ |
|
498 ' ' . __( '<a href="%s">Please update WordPress</a>.' ), |
|
499 self_admin_url( 'update-core.php' ) |
|
500 ); |
|
501 } |
|
502 } elseif ( ! $theme['updateResponse']['compatiblePHP'] ) { |
|
503 $theme_update_error .= sprintf( |
|
504 /* translators: %s: Theme name. */ |
|
505 __( 'There is a new version of %s available, but it does not work with your version of PHP.' ), |
|
506 $theme['name'] |
|
507 ); |
|
508 if ( current_user_can( 'update_php' ) ) { |
|
509 $theme_update_error .= sprintf( |
|
510 /* translators: %s: URL to Update PHP page. */ |
|
511 ' ' . __( '<a href="%s">Learn more about updating PHP</a>.' ), |
|
512 esc_url( wp_get_update_php_url() ) |
|
513 ); |
|
514 wp_update_php_annotation( '</p><p><em>', '</em>', false ); |
|
515 } |
|
516 } |
|
517 wp_admin_notice( |
|
518 $theme_update_error, |
|
519 array( |
|
520 'type' => 'error', |
|
521 'additional_classes' => array( 'notice-alt', 'inline', 'update-message' ), |
|
522 ) |
|
523 ); |
|
524 endif; |
|
525 endif; |
|
526 |
471 if ( ! $theme['compatibleWP'] || ! $theme['compatiblePHP'] ) { |
527 if ( ! $theme['compatibleWP'] || ! $theme['compatiblePHP'] ) { |
472 echo '<div class="notice inline notice-error notice-alt"><p>'; |
528 $message = ''; |
473 if ( ! $theme['compatibleWP'] && ! $theme['compatiblePHP'] ) { |
529 if ( ! $theme['compatibleWP'] && ! $theme['compatiblePHP'] ) { |
474 _e( 'This theme does not work with your versions of WordPress and PHP.' ); |
530 $message = __( 'This theme does not work with your versions of WordPress and PHP.' ); |
475 if ( current_user_can( 'update_core' ) && current_user_can( 'update_php' ) ) { |
531 if ( current_user_can( 'update_core' ) && current_user_can( 'update_php' ) ) { |
476 printf( |
532 $message .= sprintf( |
477 /* translators: 1: URL to WordPress Updates screen, 2: URL to Update PHP page. */ |
533 /* translators: 1: URL to WordPress Updates screen, 2: URL to Update PHP page. */ |
478 ' ' . __( '<a href="%1$s">Please update WordPress</a>, and then <a href="%2$s">learn more about updating PHP</a>.' ), |
534 ' ' . __( '<a href="%1$s">Please update WordPress</a>, and then <a href="%2$s">learn more about updating PHP</a>.' ), |
479 self_admin_url( 'update-core.php' ), |
535 self_admin_url( 'update-core.php' ), |
480 esc_url( wp_get_update_php_url() ) |
536 esc_url( wp_get_update_php_url() ) |
481 ); |
537 ); |
482 wp_update_php_annotation( '</p><p><em>', '</em>' ); |
538 $message .= wp_update_php_annotation( '</p><p><em>', '</em>', false ); |
483 } elseif ( current_user_can( 'update_core' ) ) { |
539 } elseif ( current_user_can( 'update_core' ) ) { |
484 printf( |
540 $message .= sprintf( |
485 /* translators: %s: URL to WordPress Updates screen. */ |
541 /* translators: %s: URL to WordPress Updates screen. */ |
486 ' ' . __( '<a href="%s">Please update WordPress</a>.' ), |
542 ' ' . __( '<a href="%s">Please update WordPress</a>.' ), |
487 self_admin_url( 'update-core.php' ) |
543 self_admin_url( 'update-core.php' ) |
488 ); |
544 ); |
489 } elseif ( current_user_can( 'update_php' ) ) { |
545 } elseif ( current_user_can( 'update_php' ) ) { |
490 printf( |
546 $message .= sprintf( |
491 /* translators: %s: URL to Update PHP page. */ |
547 /* translators: %s: URL to Update PHP page. */ |
492 ' ' . __( '<a href="%s">Learn more about updating PHP</a>.' ), |
548 ' ' . __( '<a href="%s">Learn more about updating PHP</a>.' ), |
493 esc_url( wp_get_update_php_url() ) |
549 esc_url( wp_get_update_php_url() ) |
494 ); |
550 ); |
495 wp_update_php_annotation( '</p><p><em>', '</em>' ); |
551 $message .= wp_update_php_annotation( '</p><p><em>', '</em>', false ); |
496 } |
552 } |
497 } elseif ( ! $theme['compatibleWP'] ) { |
553 } elseif ( ! $theme['compatibleWP'] ) { |
498 _e( 'This theme does not work with your version of WordPress.' ); |
554 $message .= __( 'This theme does not work with your version of WordPress.' ); |
499 if ( current_user_can( 'update_core' ) ) { |
555 if ( current_user_can( 'update_core' ) ) { |
500 printf( |
556 $message .= sprintf( |
501 /* translators: %s: URL to WordPress Updates screen. */ |
557 /* translators: %s: URL to WordPress Updates screen. */ |
502 ' ' . __( '<a href="%s">Please update WordPress</a>.' ), |
558 ' ' . __( '<a href="%s">Please update WordPress</a>.' ), |
503 self_admin_url( 'update-core.php' ) |
559 self_admin_url( 'update-core.php' ) |
504 ); |
560 ); |
505 } |
561 } |
506 } elseif ( ! $theme['compatiblePHP'] ) { |
562 } elseif ( ! $theme['compatiblePHP'] ) { |
507 _e( 'This theme does not work with your version of PHP.' ); |
563 $message .= __( 'This theme does not work with your version of PHP.' ); |
508 if ( current_user_can( 'update_php' ) ) { |
564 if ( current_user_can( 'update_php' ) ) { |
509 printf( |
565 $message .= sprintf( |
510 /* translators: %s: URL to Update PHP page. */ |
566 /* translators: %s: URL to Update PHP page. */ |
511 ' ' . __( '<a href="%s">Learn more about updating PHP</a>.' ), |
567 ' ' . __( '<a href="%s">Learn more about updating PHP</a>.' ), |
512 esc_url( wp_get_update_php_url() ) |
568 esc_url( wp_get_update_php_url() ) |
513 ); |
569 ); |
514 wp_update_php_annotation( '</p><p><em>', '</em>' ); |
570 $message .= wp_update_php_annotation( '</p><p><em>', '</em>', false ); |
515 } |
571 } |
516 } |
572 } |
517 echo '</p></div>'; |
573 |
|
574 wp_admin_notice( |
|
575 $message, |
|
576 array( |
|
577 'type' => 'error', |
|
578 'additional_classes' => array( 'inline', 'notice-alt' ), |
|
579 ) |
|
580 ); |
518 } |
581 } |
519 ?> |
582 |
520 |
|
521 <?php |
|
522 /* translators: %s: Theme name. */ |
583 /* translators: %s: Theme name. */ |
523 $details_aria_label = sprintf( _x( 'View Theme Details for %s', 'theme' ), $theme['name'] ); |
584 $details_aria_label = sprintf( _x( 'View Theme Details for %s', 'theme' ), $theme['name'] ); |
524 ?> |
585 ?> |
525 <button type="button" aria-label="<?php echo esc_attr( $details_aria_label ); ?>" class="more-details" id="<?php echo esc_attr( $aria_action ); ?>"><?php _e( 'Theme Details' ); ?></button> |
586 <button type="button" aria-label="<?php echo esc_attr( $details_aria_label ); ?>" class="more-details" id="<?php echo esc_attr( $aria_action ); ?>"><?php _e( 'Theme Details' ); ?></button> |
526 <div class="theme-author"> |
587 <div class="theme-author"> |