1<?php
2/**
3 * Widget administration screen.
4 *
5 * @package WordPress
6 * @subpackage Administration
7 */
8
9/** WordPress Administration Bootstrap */
10require_once __DIR__ . '/admin.php';
11
12/** WordPress Administration Widgets API */
13require_once ABSPATH . 'wp-admin/includes/widgets.php';
14
15if ( ! current_user_can( 'edit_theme_options' ) ) {
16 wp_die(
17 '<h1>' . __( 'You need a higher level of permission.' ) . '</h1>' .
18 '<p>' . __( 'Sorry, you are not allowed to edit theme options on this site.' ) . '</p>',
19 403
20 );
21}
22
23if ( ! current_theme_supports( 'widgets' ) ) {
24 wp_die( __( 'The theme you are currently using is not widget-aware, meaning that it has no sidebars that you are able to change. For information on making your theme widget-aware, please <a href="https://developer.wordpress.org/themes/functionality/widgets/">follow these instructions</a>.' ) );
25}
26
27// Used in the HTML title tag.
28$title = __( 'Widgets' );
29$parent_file = 'themes.php';
30
31if ( wp_use_widgets_block_editor() ) {
32 require ABSPATH . 'wp-admin/widgets-form-blocks.php';
33} else {
34 require ABSPATH . 'wp-admin/widgets-form.php';
35}
36