widgets.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435
  1. <?php
  2. /**
  3. * Widget administration screen.
  4. *
  5. * @package WordPress
  6. * @subpackage Administration
  7. */
  8. /** WordPress Administration Bootstrap */
  9. require_once __DIR__ . '/admin.php';
  10. /** WordPress Administration Widgets API */
  11. require_once ABSPATH . 'wp-admin/includes/widgets.php';
  12. if ( ! current_user_can( 'edit_theme_options' ) ) {
  13. wp_die(
  14. '<h1>' . __( 'You need a higher level of permission.' ) . '</h1>' .
  15. '<p>' . __( 'Sorry, you are not allowed to edit theme options on this site.' ) . '</p>',
  16. 403
  17. );
  18. }
  19. if ( ! current_theme_supports( 'widgets' ) ) {
  20. 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>.' ) );
  21. }
  22. // Used in the HTML title tag.
  23. $title = __( 'Widgets' );
  24. $parent_file = 'themes.php';
  25. if ( wp_use_widgets_block_editor() ) {
  26. require ABSPATH . 'wp-admin/widgets-form-blocks.php';
  27. } else {
  28. require ABSPATH . 'wp-admin/widgets-form.php';
  29. }