if ( ! current_user_can( 'switch_themes' ) && ! current_user_can( 'edit_theme_options' ) ) { wp_die( '<h1>' . __( 'You need a higher level of permission.' ) . '</h1>' . '<p>' . __( 'Sorry, you are not allowed to edit theme options on this site.' ) . '</p>', 403 ); }
if ( ! current_user_can( 'resume_theme', $_GET['stylesheet'] ) ) { wp_die( '<h1>' . __( 'You need a higher level of permission.' ) . '</h1>' . '<p>' . __( 'Sorry, you are not allowed to resume this theme.' ) . '</p>', 403 ); }
if ( ! current_user_can( 'delete_themes' ) ) { wp_die( '<h1>' . __( 'You need a higher level of permission.' ) . '</h1>' . '<p>' . __( 'Sorry, you are not allowed to delete this item.' ) . '</p>', 403 ); }
if ( ! $theme->exists() ) { wp_die( '<h1>' . __( 'An error occurred while deleting the theme.' ) . '</h1>' . '<p>' . __( 'The requested theme does not exist.' ) . '</p>', 403 ); }
$auto_updates[] = $_GET['stylesheet']; $auto_updates = array_unique( $auto_updates ); // Remove themes that have been deleted since the site option was last updated. $auto_updates = array_intersect( $auto_updates, array_keys( $all_items ) );
$auto_updates = array_diff( $auto_updates, array( $_GET['stylesheet'] ) ); // Remove themes that have been deleted since the site option was last updated. $auto_updates = array_intersect( $auto_updates, array_keys( $all_items ) );
// Used in the HTML title tag. $title = __( 'Themes' ); $parent_file = 'themes.php';
// Help tab: Overview. if ( current_user_can( 'switch_themes' ) ) { $help_overview = '<p>' . __( 'This screen is used for managing your installed themes. Aside from the default theme(s) included with your WordPress installation, themes are designed and developed by third parties.' ) . '</p>' . '<p>' . __( 'From this screen you can:' ) . '</p>' . '<ul><li>' . __( 'Hover or tap to see Activate and Live Preview buttons' ) . '</li>' . '<li>' . __( 'Click on the theme to see the theme name, version, author, description, tags, and the Delete link' ) . '</li>' . '<li>' . __( 'Click Customize for the active theme or Live Preview for any other theme to see a live preview' ) . '</li></ul>' . '<p>' . __( 'The active theme is displayed highlighted as the first theme.' ) . '</p>' . '<p>' . __( 'The search for installed themes will search for terms in their name, description, author, or tag.' ) . ' <span id="live-search-desc">' . __( 'The search results will be updated as you type.' ) . '</span></p>';
get_current_screen()->add_help_tab( array( 'id' => 'overview', 'title' => __( 'Overview' ), 'content' => $help_overview, ) ); } // End if 'switch_themes'.
// Help tab: Adding Themes. if ( current_user_can( 'install_themes' ) ) { if ( is_multisite() ) { $help_install = '<p>' . __( 'Installing themes on Multisite can only be done from the Network Admin section.' ) . '</p>'; } else { $help_install = '<p>' . sprintf( /* translators: %s: https://wordpress.org/themes/ */ __( 'If you would like to see more themes to choose from, click on the “Add Theme” button and you will be able to browse or search for additional themes from the <a href="%s">WordPress Theme Directory</a>. Themes in the WordPress Theme Directory are designed and developed by third parties, and are compatible with the license WordPress uses. Oh, and they are free!' ), __( 'https://wordpress.org/themes/' ) ) . '</p>'; }
// Help tab: Previewing and Customizing. if ( current_user_can( 'edit_theme_options' ) && current_user_can( 'customize' ) ) { $help_customize = '<p>' . __( 'Tap or hover on any theme then click the Live Preview button to see a live preview of that theme and change theme options in a separate, full-screen view. You can also find a Live Preview button at the bottom of the theme details screen. Any installed theme can be previewed and customized in this way.' ) . '</p>' . '<p>' . __( 'The theme being previewed is fully interactive — navigate to different pages to see how the theme handles posts, archives, and other page templates. The settings may differ depending on what theme features the theme being previewed supports. To accept the new settings and activate the theme all in one step, click the Activate & Publish button above the menu.' ) . '</p>' . '<p>' . __( 'When previewing on smaller monitors, you can use the collapse icon at the bottom of the left-hand pane. This will hide the pane, giving you more room to preview your site in the new theme. To bring the pane back, click on the collapse icon again.' ) . '</p>';
get_current_screen()->add_help_tab( array( 'id' => 'customize-preview-themes', 'title' => __( 'Previewing and Customizing' ), 'content' => $help_customize, ) ); } // End if 'edit_theme_options' && 'customize'.
$help_sidebar_autoupdates = '';
// Help tab: Auto-updates. if ( current_user_can( 'update_themes' ) && wp_is_auto_update_enabled_for_type( 'theme' ) ) { $help_tab_autoupdates = '<p>' . __( 'Auto-updates can be enabled or disabled for each individual theme. Themes with auto-updates enabled will display the estimated date of the next auto-update. Auto-updates depends on the WP-Cron task scheduling system.' ) . '</p>' . '<p>' . __( 'Please note: Third-party themes and plugins, or custom code, may override WordPress scheduling.' ) . '</p>';
/** * Filters the JavaScript template used to display the auto-update setting for a theme (in the overlay). * * See {@see wp_prepare_themes_for_js()} for the properties of the `data` object. * * @since 5.5.0 * * @param string $template The template for displaying the auto-update setting link. */ return apply_filters( 'theme_auto_update_setting_template', $template ); }