64 |
64 |
65 if ( is_wp_error( $wp_filesystem->errors ) && $wp_filesystem->errors->has_errors() ) { |
65 if ( is_wp_error( $wp_filesystem->errors ) && $wp_filesystem->errors->has_errors() ) { |
66 return new WP_Error( 'fs_error', __( 'Filesystem error.' ), $wp_filesystem->errors ); |
66 return new WP_Error( 'fs_error', __( 'Filesystem error.' ), $wp_filesystem->errors ); |
67 } |
67 } |
68 |
68 |
69 // Get the base plugin folder. |
69 // Get the base theme folder. |
70 $themes_dir = $wp_filesystem->wp_themes_dir(); |
70 $themes_dir = $wp_filesystem->wp_themes_dir(); |
71 if ( empty( $themes_dir ) ) { |
71 if ( empty( $themes_dir ) ) { |
72 return new WP_Error( 'fs_no_themes_dir', __( 'Unable to locate WordPress theme directory.' ) ); |
72 return new WP_Error( 'fs_no_themes_dir', __( 'Unable to locate WordPress theme directory.' ) ); |
73 } |
73 } |
74 |
74 |
78 * @since 5.8.0 |
78 * @since 5.8.0 |
79 * |
79 * |
80 * @param string $stylesheet Stylesheet of the theme to delete. |
80 * @param string $stylesheet Stylesheet of the theme to delete. |
81 */ |
81 */ |
82 do_action( 'delete_theme', $stylesheet ); |
82 do_action( 'delete_theme', $stylesheet ); |
|
83 |
|
84 $theme = wp_get_theme( $stylesheet ); |
83 |
85 |
84 $themes_dir = trailingslashit( $themes_dir ); |
86 $themes_dir = trailingslashit( $themes_dir ); |
85 $theme_dir = trailingslashit( $themes_dir . $stylesheet ); |
87 $theme_dir = trailingslashit( $themes_dir . $stylesheet ); |
86 $deleted = $wp_filesystem->delete( $theme_dir, true ); |
88 $deleted = $wp_filesystem->delete( $theme_dir, true ); |
87 |
89 |
110 $translations = $theme_translations[ $stylesheet ]; |
112 $translations = $theme_translations[ $stylesheet ]; |
111 |
113 |
112 foreach ( $translations as $translation => $data ) { |
114 foreach ( $translations as $translation => $data ) { |
113 $wp_filesystem->delete( WP_LANG_DIR . '/themes/' . $stylesheet . '-' . $translation . '.po' ); |
115 $wp_filesystem->delete( WP_LANG_DIR . '/themes/' . $stylesheet . '-' . $translation . '.po' ); |
114 $wp_filesystem->delete( WP_LANG_DIR . '/themes/' . $stylesheet . '-' . $translation . '.mo' ); |
116 $wp_filesystem->delete( WP_LANG_DIR . '/themes/' . $stylesheet . '-' . $translation . '.mo' ); |
|
117 $wp_filesystem->delete( WP_LANG_DIR . '/themes/' . $stylesheet . '-' . $translation . '.l10n.php' ); |
115 |
118 |
116 $json_translation_files = glob( WP_LANG_DIR . '/themes/' . $stylesheet . '-' . $translation . '-*.json' ); |
119 $json_translation_files = glob( WP_LANG_DIR . '/themes/' . $stylesheet . '-' . $translation . '-*.json' ); |
117 if ( $json_translation_files ) { |
120 if ( $json_translation_files ) { |
118 array_map( array( $wp_filesystem, 'delete' ), $json_translation_files ); |
121 array_map( array( $wp_filesystem, 'delete' ), $json_translation_files ); |
119 } |
122 } |
123 // Remove the theme from allowed themes on the network. |
126 // Remove the theme from allowed themes on the network. |
124 if ( is_multisite() ) { |
127 if ( is_multisite() ) { |
125 WP_Theme::network_disable_theme( $stylesheet ); |
128 WP_Theme::network_disable_theme( $stylesheet ); |
126 } |
129 } |
127 |
130 |
|
131 // Clear theme caches. |
|
132 $theme->cache_delete(); |
|
133 |
128 // Force refresh of theme update information. |
134 // Force refresh of theme update information. |
129 delete_site_transient( 'update_themes' ); |
135 delete_site_transient( 'update_themes' ); |
130 |
136 |
131 return true; |
137 return true; |
132 } |
138 } |
154 * @param string $fullpath Full path to the theme file |
160 * @param string $fullpath Full path to the theme file |
155 * @param string $containingfolder Path of the theme parent folder |
161 * @param string $containingfolder Path of the theme parent folder |
156 * @return string |
162 * @return string |
157 */ |
163 */ |
158 function _get_template_edit_filename( $fullpath, $containingfolder ) { |
164 function _get_template_edit_filename( $fullpath, $containingfolder ) { |
159 return str_replace( dirname( dirname( $containingfolder ) ), '', $fullpath ); |
165 return str_replace( dirname( $containingfolder, 2 ), '', $fullpath ); |
160 } |
166 } |
161 |
167 |
162 /** |
168 /** |
163 * Check if there is an update for a theme available. |
169 * Check if there is an update for a theme available. |
164 * |
170 * |
297 * 'Threaded Comments', and 'Translation Ready' features. |
303 * 'Threaded Comments', and 'Translation Ready' features. |
298 * @since 5.5.0 Added 'Block Editor Patterns', 'Block Editor Styles', |
304 * @since 5.5.0 Added 'Block Editor Patterns', 'Block Editor Styles', |
299 * and 'Full Site Editing' features. |
305 * and 'Full Site Editing' features. |
300 * @since 5.5.0 Added 'Wide Blocks' layout option. |
306 * @since 5.5.0 Added 'Wide Blocks' layout option. |
301 * @since 5.8.1 Added 'Template Editing' feature. |
307 * @since 5.8.1 Added 'Template Editing' feature. |
|
308 * @since 6.1.1 Replaced 'Full Site Editing' feature name with 'Site Editor'. |
|
309 * @since 6.2.0 Added 'Style Variations' feature. |
302 * |
310 * |
303 * @param bool $api Optional. Whether try to fetch tags from the WordPress.org API. Defaults to true. |
311 * @param bool $api Optional. Whether try to fetch tags from the WordPress.org API. Defaults to true. |
304 * @return array Array of features keyed by category with translations keyed by slug. |
312 * @return array Array of features keyed by category with translations keyed by slug. |
305 */ |
313 */ |
306 function get_theme_feature_list( $api = true ) { |
314 function get_theme_feature_list( $api = true ) { |
329 'custom-logo' => __( 'Custom Logo' ), |
337 'custom-logo' => __( 'Custom Logo' ), |
330 'editor-style' => __( 'Editor Style' ), |
338 'editor-style' => __( 'Editor Style' ), |
331 'featured-image-header' => __( 'Featured Image Header' ), |
339 'featured-image-header' => __( 'Featured Image Header' ), |
332 'featured-images' => __( 'Featured Images' ), |
340 'featured-images' => __( 'Featured Images' ), |
333 'footer-widgets' => __( 'Footer Widgets' ), |
341 'footer-widgets' => __( 'Footer Widgets' ), |
334 'full-site-editing' => __( 'Full Site Editing' ), |
342 'full-site-editing' => __( 'Site Editor' ), |
335 'full-width-template' => __( 'Full Width Template' ), |
343 'full-width-template' => __( 'Full Width Template' ), |
336 'post-formats' => __( 'Post Formats' ), |
344 'post-formats' => __( 'Post Formats' ), |
337 'sticky-post' => __( 'Sticky Post' ), |
345 'sticky-post' => __( 'Sticky Post' ), |
|
346 'style-variations' => __( 'Style Variations' ), |
338 'template-editing' => __( 'Template Editing' ), |
347 'template-editing' => __( 'Template Editing' ), |
339 'theme-options' => __( 'Theme Options' ), |
348 'theme-options' => __( 'Theme Options' ), |
340 ), |
349 ), |
341 |
350 |
342 __( 'Layout' ) => array( |
351 __( 'Layout' ) => array( |
437 * | `$locale` | Yes | Yes | No | No | |
446 * | `$locale` | Yes | Yes | No | No | |
438 * | `$fields` | Yes | Yes | No | No | |
447 * | `$fields` | Yes | Yes | No | No | |
439 * |
448 * |
440 * @since 2.8.0 |
449 * @since 2.8.0 |
441 * |
450 * |
442 * @param string $action API action to perform: 'query_themes', 'theme_information', |
451 * @param string $action API action to perform: Accepts 'query_themes', 'theme_information', |
443 * 'hot_tags' or 'feature_list'. |
452 * 'hot_tags' or 'feature_list'. |
444 * @param array|object $args { |
453 * @param array|object $args { |
445 * Optional. Array or object of arguments to serialize for the Themes API. |
454 * Optional. Array or object of arguments to serialize for the Themes API. Default empty array. |
446 * |
455 * |
447 * @type string $slug The theme slug. Default empty. |
456 * @type string $slug The theme slug. Default empty. |
448 * @type int $per_page Number of themes per page. Default 24. |
457 * @type int $per_page Number of themes per page. Default 24. |
449 * @type int $page Number of current page. Default 1. |
458 * @type int $page Number of current page. Default 1. |
450 * @type int $number Number of tags to be queried. |
459 * @type int $number Number of tags to be queried. |
550 if ( $ssl ) { |
559 if ( $ssl ) { |
551 $url = set_url_scheme( $url, 'https' ); |
560 $url = set_url_scheme( $url, 'https' ); |
552 } |
561 } |
553 |
562 |
554 $http_args = array( |
563 $http_args = array( |
|
564 'timeout' => 15, |
555 'user-agent' => 'WordPress/' . $wp_version . '; ' . home_url( '/' ), |
565 'user-agent' => 'WordPress/' . $wp_version . '; ' . home_url( '/' ), |
556 ); |
566 ); |
557 $request = wp_remote_get( $url, $http_args ); |
567 $request = wp_remote_get( $url, $http_args ); |
558 |
568 |
559 if ( $ssl && is_wp_error( $request ) ) { |
569 if ( $ssl && is_wp_error( $request ) ) { |
560 if ( ! wp_doing_ajax() ) { |
570 if ( ! wp_doing_ajax() ) { |
561 trigger_error( |
571 wp_trigger_error( |
|
572 __FUNCTION__, |
562 sprintf( |
573 sprintf( |
563 /* translators: %s: Support forums URL. */ |
574 /* translators: %s: Support forums URL. */ |
564 __( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server’s configuration. If you continue to have problems, please try the <a href="%s">support forums</a>.' ), |
575 __( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server’s configuration. If you continue to have problems, please try the <a href="%s">support forums</a>.' ), |
565 __( 'https://wordpress.org/support/forums/' ) |
576 __( 'https://wordpress.org/support/forums/' ) |
566 ) . ' ' . __( '(WordPress could not establish a secure connection to WordPress.org. Please contact your server administrator.)' ), |
577 ) . ' ' . __( '(WordPress could not establish a secure connection to WordPress.org. Please contact your server administrator.)' ), |
705 $can_edit_theme_options = current_user_can( 'edit_theme_options' ); |
716 $can_edit_theme_options = current_user_can( 'edit_theme_options' ); |
706 $can_customize = current_user_can( 'customize' ); |
717 $can_customize = current_user_can( 'customize' ); |
707 $is_block_theme = $theme->is_block_theme(); |
718 $is_block_theme = $theme->is_block_theme(); |
708 |
719 |
709 if ( $is_block_theme && $can_edit_theme_options ) { |
720 if ( $is_block_theme && $can_edit_theme_options ) { |
710 $customize_action = esc_url( admin_url( 'site-editor.php' ) ); |
721 $customize_action = admin_url( 'site-editor.php' ); |
|
722 if ( $current_theme !== $slug ) { |
|
723 $customize_action = add_query_arg( 'wp_theme_preview', $slug, $customize_action ); |
|
724 } |
711 } elseif ( ! $is_block_theme && $can_customize && $can_edit_theme_options ) { |
725 } elseif ( ! $is_block_theme && $can_customize && $can_edit_theme_options ) { |
712 $customize_action = esc_url( |
726 $customize_action = wp_customize_url( $slug ); |
713 add_query_arg( |
727 } |
714 array( |
728 if ( null !== $customize_action ) { |
715 'return' => urlencode( esc_url_raw( remove_query_arg( wp_removable_query_args(), wp_unslash( $_SERVER['REQUEST_URI'] ) ) ) ), |
729 $customize_action = add_query_arg( |
716 ), |
730 array( |
717 wp_customize_url( $slug ) |
731 'return' => urlencode( sanitize_url( remove_query_arg( wp_removable_query_args(), wp_unslash( $_SERVER['REQUEST_URI'] ) ) ) ), |
718 ) |
732 ), |
|
733 $customize_action |
719 ); |
734 ); |
|
735 $customize_action = esc_url( $customize_action ); |
720 } |
736 } |
721 |
737 |
722 $update_requires_wp = isset( $updates[ $slug ]['requires'] ) ? $updates[ $slug ]['requires'] : null; |
738 $update_requires_wp = isset( $updates[ $slug ]['requires'] ) ? $updates[ $slug ]['requires'] : null; |
723 $update_requires_php = isset( $updates[ $slug ]['requires_php'] ) ? $updates[ $slug ]['requires_php'] : null; |
739 $update_requires_php = isset( $updates[ $slug ]['requires_php'] ) ? $updates[ $slug ]['requires_php'] : null; |
724 |
740 |
814 ?> |
830 ?> |
815 <script type="text/html" id="tmpl-customize-themes-details-view"> |
831 <script type="text/html" id="tmpl-customize-themes-details-view"> |
816 <div class="theme-backdrop"></div> |
832 <div class="theme-backdrop"></div> |
817 <div class="theme-wrap wp-clearfix" role="document"> |
833 <div class="theme-wrap wp-clearfix" role="document"> |
818 <div class="theme-header"> |
834 <div class="theme-header"> |
819 <button type="button" class="left dashicons dashicons-no"><span class="screen-reader-text"><?php _e( 'Show previous theme' ); ?></span></button> |
835 <button type="button" class="left dashicons dashicons-no"><span class="screen-reader-text"> |
820 <button type="button" class="right dashicons dashicons-no"><span class="screen-reader-text"><?php _e( 'Show next theme' ); ?></span></button> |
836 <?php |
821 <button type="button" class="close dashicons dashicons-no"><span class="screen-reader-text"><?php _e( 'Close details dialog' ); ?></span></button> |
837 /* translators: Hidden accessibility text. */ |
|
838 _e( 'Show previous theme' ); |
|
839 ?> |
|
840 </span></button> |
|
841 <button type="button" class="right dashicons dashicons-no"><span class="screen-reader-text"> |
|
842 <?php |
|
843 /* translators: Hidden accessibility text. */ |
|
844 _e( 'Show next theme' ); |
|
845 ?> |
|
846 </span></button> |
|
847 <button type="button" class="close dashicons dashicons-no"><span class="screen-reader-text"> |
|
848 <?php |
|
849 /* translators: Hidden accessibility text. */ |
|
850 _e( 'Close details dialog' ); |
|
851 ?> |
|
852 </span></button> |
822 </div> |
853 </div> |
823 <div class="theme-about wp-clearfix"> |
854 <div class="theme-about wp-clearfix"> |
824 <div class="theme-screenshots"> |
855 <div class="theme-screenshots"> |
825 <# if ( data.screenshot && data.screenshot[0] ) { #> |
856 <# if ( data.screenshot && data.screenshot[0] ) { #> |
826 <div class="screenshot"><img src="{{ data.screenshot[0] }}?ver={{ data.version }}" alt="" /></div> |
857 <div class="screenshot"><img src="{{ data.screenshot[0] }}?ver={{ data.version }}" alt="" /></div> |
853 <?php |
884 <?php |
854 printf( |
885 printf( |
855 '%1$s <span class="screen-reader-text">%2$s</span>', |
886 '%1$s <span class="screen-reader-text">%2$s</span>', |
856 /* translators: %s: Number of ratings. */ |
887 /* translators: %s: Number of ratings. */ |
857 sprintf( __( '(%s ratings)' ), '{{ data.num_ratings }}' ), |
888 sprintf( __( '(%s ratings)' ), '{{ data.num_ratings }}' ), |
858 /* translators: Accessibility text. */ |
889 /* translators: Hidden accessibility text. */ |
859 __( '(opens in a new tab)' ) |
890 __( '(opens in a new tab)' ) |
860 ); |
891 ); |
861 ?> |
892 ?> |
862 </a> |
893 </a> |
863 </div> |
894 </div> |
1032 |
1063 |
1033 <div class="theme-actions"> |
1064 <div class="theme-actions"> |
1034 <# if ( data.active ) { #> |
1065 <# if ( data.active ) { #> |
1035 <button type="button" class="button button-primary customize-theme"><?php _e( 'Customize' ); ?></button> |
1066 <button type="button" class="button button-primary customize-theme"><?php _e( 'Customize' ); ?></button> |
1036 <# } else if ( 'installed' === data.type ) { #> |
1067 <# } else if ( 'installed' === data.type ) { #> |
1037 <?php if ( current_user_can( 'delete_themes' ) ) { ?> |
1068 <div class="theme-inactive-actions"> |
1038 <# if ( data.actions && data.actions['delete'] ) { #> |
|
1039 <a href="{{{ data.actions['delete'] }}}" data-slug="{{ data.id }}" class="button button-secondary delete-theme"><?php _e( 'Delete' ); ?></a> |
|
1040 <# } #> |
|
1041 <?php } ?> |
|
1042 |
|
1043 <# if ( data.blockTheme ) { #> |
1069 <# if ( data.blockTheme ) { #> |
1044 <?php |
1070 <?php |
1045 /* translators: %s: Theme name. */ |
1071 /* translators: %s: Theme name. */ |
1046 $aria_label = sprintf( _x( 'Activate %s', 'theme' ), '{{ data.name }}' ); |
1072 $aria_label = sprintf( _x( 'Activate %s', 'theme' ), '{{ data.name }}' ); |
1047 ?> |
1073 ?> |
1053 <button type="button" class="button button-primary preview-theme" data-slug="{{ data.id }}"><?php _e( 'Live Preview' ); ?></button> |
1079 <button type="button" class="button button-primary preview-theme" data-slug="{{ data.id }}"><?php _e( 'Live Preview' ); ?></button> |
1054 <# } else { #> |
1080 <# } else { #> |
1055 <button class="button button-primary disabled"><?php _e( 'Live Preview' ); ?></button> |
1081 <button class="button button-primary disabled"><?php _e( 'Live Preview' ); ?></button> |
1056 <# } #> |
1082 <# } #> |
1057 <# } #> |
1083 <# } #> |
|
1084 </div> |
|
1085 <?php if ( current_user_can( 'delete_themes' ) ) { ?> |
|
1086 <# if ( data.actions && data.actions['delete'] ) { #> |
|
1087 <a href="{{{ data.actions['delete'] }}}" data-slug="{{ data.id }}" class="button button-secondary delete-theme"><?php _e( 'Delete' ); ?></a> |
|
1088 <# } #> |
|
1089 <?php } ?> |
1058 <# } else { #> |
1090 <# } else { #> |
1059 <# if ( data.compatibleWP && data.compatiblePHP ) { #> |
1091 <# if ( data.compatibleWP && data.compatiblePHP ) { #> |
1060 <button type="button" class="button theme-install" data-slug="{{ data.id }}"><?php _e( 'Install' ); ?></button> |
1092 <button type="button" class="button theme-install" data-slug="{{ data.id }}"><?php _e( 'Install' ); ?></button> |
1061 <button type="button" class="button button-primary theme-install preview" data-slug="{{ data.id }}"><?php _e( 'Install & Preview' ); ?></button> |
1093 <button type="button" class="button button-primary theme-install preview" data-slug="{{ data.id }}"><?php _e( 'Install & Preview' ); ?></button> |
1062 <# } else { #> |
1094 <# } else { #> |
1078 * the {@link https://developer.wordpress.org/themes/basics/conditional-tags/ |
1110 * the {@link https://developer.wordpress.org/themes/basics/conditional-tags/ |
1079 * Conditional Tags} article in the Theme Developer Handbook. |
1111 * Conditional Tags} article in the Theme Developer Handbook. |
1080 * |
1112 * |
1081 * @since 5.2.0 |
1113 * @since 5.2.0 |
1082 * |
1114 * |
|
1115 * @global WP_Paused_Extensions_Storage $_paused_themes |
|
1116 * |
1083 * @param string $theme Path to the theme directory relative to the themes directory. |
1117 * @param string $theme Path to the theme directory relative to the themes directory. |
1084 * @return bool True, if in the list of paused themes. False, not in the list. |
1118 * @return bool True, if in the list of paused themes. False, not in the list. |
1085 */ |
1119 */ |
1086 function is_theme_paused( $theme ) { |
1120 function is_theme_paused( $theme ) { |
1087 if ( ! isset( $GLOBALS['_paused_themes'] ) ) { |
1121 if ( ! isset( $GLOBALS['_paused_themes'] ) ) { |
1097 |
1131 |
1098 /** |
1132 /** |
1099 * Gets the error that was recorded for a paused theme. |
1133 * Gets the error that was recorded for a paused theme. |
1100 * |
1134 * |
1101 * @since 5.2.0 |
1135 * @since 5.2.0 |
|
1136 * |
|
1137 * @global WP_Paused_Extensions_Storage $_paused_themes |
1102 * |
1138 * |
1103 * @param string $theme Path to the theme directory relative to the themes |
1139 * @param string $theme Path to the theme directory relative to the themes |
1104 * directory. |
1140 * directory. |
1105 * @return array|false Array of error information as it was returned by |
1141 * @return array|false Array of error information as it was returned by |
1106 * `error_get_last()`, or false if none was recorded. |
1142 * `error_get_last()`, or false if none was recorded. |
1127 * include the file. If the theme fails, then the redirection will not be overwritten |
1163 * include the file. If the theme fails, then the redirection will not be overwritten |
1128 * with the success message and the theme will not be resumed. |
1164 * with the success message and the theme will not be resumed. |
1129 * |
1165 * |
1130 * @since 5.2.0 |
1166 * @since 5.2.0 |
1131 * |
1167 * |
|
1168 * @global string $wp_stylesheet_path Path to current theme's stylesheet directory. |
|
1169 * @global string $wp_template_path Path to current theme's template directory. |
|
1170 * |
1132 * @param string $theme Single theme to resume. |
1171 * @param string $theme Single theme to resume. |
1133 * @param string $redirect Optional. URL to redirect to. Default empty string. |
1172 * @param string $redirect Optional. URL to redirect to. Default empty string. |
1134 * @return bool|WP_Error True on success, false if `$theme` was not paused, |
1173 * @return bool|WP_Error True on success, false if `$theme` was not paused, |
1135 * `WP_Error` on failure. |
1174 * `WP_Error` on failure. |
1136 */ |
1175 */ |
1137 function resume_theme( $theme, $redirect = '' ) { |
1176 function resume_theme( $theme, $redirect = '' ) { |
|
1177 global $wp_stylesheet_path, $wp_template_path; |
|
1178 |
1138 list( $extension ) = explode( '/', $theme ); |
1179 list( $extension ) = explode( '/', $theme ); |
1139 |
1180 |
1140 /* |
1181 /* |
1141 * We'll override this later if the theme could be resumed without |
1182 * We'll override this later if the theme could be resumed without |
1142 * creating a fatal error. |
1183 * creating a fatal error. |
1143 */ |
1184 */ |
1144 if ( ! empty( $redirect ) ) { |
1185 if ( ! empty( $redirect ) ) { |
1145 $functions_path = ''; |
1186 $functions_path = ''; |
1146 if ( strpos( STYLESHEETPATH, $extension ) ) { |
1187 if ( str_contains( $wp_stylesheet_path, $extension ) ) { |
1147 $functions_path = STYLESHEETPATH . '/functions.php'; |
1188 $functions_path = $wp_stylesheet_path . '/functions.php'; |
1148 } elseif ( strpos( TEMPLATEPATH, $extension ) ) { |
1189 } elseif ( str_contains( $wp_template_path, $extension ) ) { |
1149 $functions_path = TEMPLATEPATH . '/functions.php'; |
1190 $functions_path = $wp_template_path . '/functions.php'; |
1150 } |
1191 } |
1151 |
1192 |
1152 if ( ! empty( $functions_path ) ) { |
1193 if ( ! empty( $functions_path ) ) { |
1153 wp_redirect( |
1194 wp_redirect( |
1154 add_query_arg( |
1195 add_query_arg( |
1183 /** |
1224 /** |
1184 * Renders an admin notice in case some themes have been paused due to errors. |
1225 * Renders an admin notice in case some themes have been paused due to errors. |
1185 * |
1226 * |
1186 * @since 5.2.0 |
1227 * @since 5.2.0 |
1187 * |
1228 * |
1188 * @global string $pagenow The filename of the current screen. |
1229 * @global string $pagenow The filename of the current screen. |
|
1230 * @global WP_Paused_Extensions_Storage $_paused_themes |
1189 */ |
1231 */ |
1190 function paused_themes_notice() { |
1232 function paused_themes_notice() { |
1191 if ( 'themes.php' === $GLOBALS['pagenow'] ) { |
1233 if ( 'themes.php' === $GLOBALS['pagenow'] ) { |
1192 return; |
1234 return; |
1193 } |
1235 } |
1198 |
1240 |
1199 if ( ! isset( $GLOBALS['_paused_themes'] ) || empty( $GLOBALS['_paused_themes'] ) ) { |
1241 if ( ! isset( $GLOBALS['_paused_themes'] ) || empty( $GLOBALS['_paused_themes'] ) ) { |
1200 return; |
1242 return; |
1201 } |
1243 } |
1202 |
1244 |
1203 printf( |
1245 $message = sprintf( |
1204 '<div class="notice notice-error"><p><strong>%s</strong><br>%s</p><p><a href="%s">%s</a></p></div>', |
1246 '<p><strong>%s</strong><br>%s</p><p><a href="%s">%s</a></p>', |
1205 __( 'One or more themes failed to load properly.' ), |
1247 __( 'One or more themes failed to load properly.' ), |
1206 __( 'You can find more details and make changes on the Themes screen.' ), |
1248 __( 'You can find more details and make changes on the Themes screen.' ), |
1207 esc_url( admin_url( 'themes.php' ) ), |
1249 esc_url( admin_url( 'themes.php' ) ), |
1208 __( 'Go to the Themes screen' ) |
1250 __( 'Go to the Themes screen' ) |
1209 ); |
1251 ); |
|
1252 wp_admin_notice( |
|
1253 $message, |
|
1254 array( |
|
1255 'type' => 'error', |
|
1256 'paragraph_wrap' => false, |
|
1257 ) |
|
1258 ); |
1210 } |
1259 } |