[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)

Search

title

Body

[close]

/wp-admin/ -> index.php (source)

   1  <?php
   2  /**
   3   * Dashboard Administration Screen
   4   *
   5   * @package WordPress
   6   * @subpackage Administration
   7   */
   8  
   9  /** Load WordPress Bootstrap */
  10  require_once  __DIR__ . '/admin.php';
  11  
  12  /** Load WordPress dashboard API */
  13  require_once  ABSPATH . 'wp-admin/includes/dashboard.php';
  14  
  15  wp_dashboard_setup();
  16  
  17  wp_enqueue_script( 'dashboard' );
  18  
  19  if ( current_user_can( 'install_plugins' ) ) {
  20      wp_enqueue_script( 'plugin-install' );
  21      wp_enqueue_script( 'updates' );
  22  }
  23  if ( current_user_can( 'upload_files' ) ) {
  24      wp_enqueue_script( 'media-upload' );
  25  }
  26  add_thickbox();
  27  
  28  if ( wp_is_mobile() ) {
  29      wp_enqueue_script( 'jquery-touch-punch' );
  30  }
  31  
  32  // Used in the HTML title tag.
  33  $title       = __( 'Dashboard' );
  34  $parent_file = 'index.php';
  35  
  36  $help  = '<p>' . __( 'Welcome to your WordPress Dashboard!' ) . '</p>';
  37  $help .= '<p>' . __( 'The Dashboard is the first place you will come to every time you log into your site. It is where you will find all your WordPress tools. If you need help, just click the &#8220;Help&#8221; tab above the screen title.' ) . '</p>';
  38  
  39  $screen = get_current_screen();
  40  
  41  $screen->add_help_tab(
  42      array(
  43          'id'      => 'overview',
  44          'title'   => __( 'Overview' ),
  45          'content' => $help,
  46      )
  47  );
  48  
  49  // Help tabs.
  50  
  51  $help  = '<p>' . __( 'The left-hand navigation menu provides links to all of the WordPress administration screens, with submenu items displayed on hover. You can minimize this menu to a narrow icon strip by clicking on the Collapse Menu arrow at the bottom.' ) . '</p>';
  52  $help .= '<p>' . __( 'Links in the Toolbar at the top of the screen connect your dashboard and the front end of your site, and provide access to your profile and helpful WordPress information.' ) . '</p>';
  53  
  54  $screen->add_help_tab(
  55      array(
  56          'id'      => 'help-navigation',
  57          'title'   => __( 'Navigation' ),
  58          'content' => $help,
  59      )
  60  );
  61  
  62  $help  = '<p>' . __( 'You can use the following controls to arrange your Dashboard screen to suit your workflow. This is true on most other administration screens as well.' ) . '</p>';
  63  $help .= '<p>' . __( '<strong>Screen Options</strong> &mdash; Use the Screen Options tab to choose which Dashboard boxes to show.' ) . '</p>';
  64  $help .= '<p>' . __( '<strong>Drag and Drop</strong> &mdash; To rearrange the boxes, drag and drop by clicking on the title bar of the selected box and releasing when you see a gray dotted-line rectangle appear in the location you want to place the box.' ) . '</p>';
  65  $help .= '<p>' . __( '<strong>Box Controls</strong> &mdash; Click the title bar of the box to expand or collapse it. Some boxes added by plugins may have configurable content, and will show a &#8220;Configure&#8221; link in the title bar if you hover over it.' ) . '</p>';
  66  
  67  $screen->add_help_tab(
  68      array(
  69          'id'      => 'help-layout',
  70          'title'   => __( 'Layout' ),
  71          'content' => $help,
  72      )
  73  );
  74  
  75  $help = '<p>' . __( 'The boxes on your Dashboard screen are:' ) . '</p>';
  76  
  77  if ( current_user_can( 'edit_theme_options' ) ) {
  78      $help .= '<p>' . __( '<strong>Welcome</strong> &mdash; Shows links for some of the most common tasks when setting up a new site.' ) . '</p>';
  79  }
  80  
  81  if ( current_user_can( 'view_site_health_checks' ) ) {
  82      $help .= '<p>' . __( '<strong>Site Health Status</strong> &mdash; Informs you of any potential issues that should be addressed to improve the performance or security of your website.' ) . '</p>';
  83  }
  84  
  85  if ( current_user_can( 'edit_posts' ) ) {
  86      $help .= '<p>' . __( '<strong>At a Glance</strong> &mdash; Displays a summary of the content on your site and identifies which theme and version of WordPress you are using.' ) . '</p>';
  87  }
  88  
  89  $help .= '<p>' . __( '<strong>Activity</strong> &mdash; Shows upcoming scheduled posts, recently published posts, and posts published on this day in previous years.' ) . '</p>';
  90  
  91  if ( _wp_dashboard_has_received_comments() ) {
  92      $help .= '<p>' . __( '<strong>Recent Comments</strong> &mdash; Shows the most recent comments on your posts and allows you to moderate them.' ) . '</p>';
  93  }
  94  
  95  if ( is_blog_admin() && current_user_can( 'edit_posts' ) ) {
  96      $help .= '<p>' . __( "<strong>Quick Draft</strong> &mdash; Allows you to create a new post and save it as a draft. Also displays links to the 3 most recent draft posts you've started." ) . '</p>';
  97  }
  98  
  99  $help .= '<p>' . sprintf(
 100      /* translators: %s: WordPress Planet URL. */
 101      __( '<strong>WordPress Events and News</strong> &mdash; Upcoming events near you as well as the latest news from the official WordPress project and the <a href="%s">WordPress Planet</a>.' ),
 102      __( 'https://planet.wordpress.org/' )
 103  ) . '</p>';
 104  
 105  $screen->add_help_tab(
 106      array(
 107          'id'      => 'help-content',
 108          'title'   => __( 'Content' ),
 109          'content' => $help,
 110      )
 111  );
 112  
 113  unset( $help );
 114  
 115  $wp_version = get_bloginfo( 'version', 'display' );
 116  /* translators: %s: WordPress version. */
 117  $wp_version_text = sprintf( __( 'Version %s' ), $wp_version );
 118  $is_dev_version  = preg_match( '/alpha|beta|RC/', $wp_version );
 119  
 120  if ( ! $is_dev_version ) {
 121      $version_url = sprintf(
 122          /* translators: %s: WordPress version. */
 123          esc_url( __( 'https://wordpress.org/documentation/wordpress-version/version-%s/' ) ),
 124          sanitize_title( $wp_version )
 125      );
 126  
 127      $wp_version_text = sprintf(
 128          '<a href="%1$s">%2$s</a>',
 129          $version_url,
 130          $wp_version_text
 131      );
 132  }
 133  
 134  $screen->set_help_sidebar(
 135      '<p><strong>' . __( 'For more information:' ) . '</strong></p>' .
 136      '<p>' . __( '<a href="https://wordpress.org/documentation/article/dashboard-screen/">Documentation on Dashboard</a>' ) . '</p>' .
 137      '<p>' . __( '<a href="https://wordpress.org/support/forums/">Support forums</a>' ) . '</p>' .
 138      '<p>' . $wp_version_text . '</p>'
 139  );
 140  
 141  require_once  ABSPATH . 'wp-admin/admin-header.php';
 142  ?>
 143  
 144  <div class="wrap">
 145      <h1><?php echo esc_html( $title ); ?></h1>
 146  
 147      <?php
 148      if ( ! empty( $_GET['admin_email_remind_later'] ) ) :
 149          /** This filter is documented in wp-login.php */
 150          $remind_interval = (int) apply_filters( 'admin_email_remind_interval', 3 * DAY_IN_SECONDS );
 151          $postponed_time  = get_option( 'admin_email_lifespan' );
 152  
 153          /*
 154           * Calculate how many seconds it's been since the reminder was postponed.
 155           * This allows us to not show it if the query arg is set, but visited due to caches, bookmarks or similar.
 156           */
 157          $time_passed = time() - ( $postponed_time - $remind_interval );
 158  
 159          // Only show the dashboard notice if it's been less than a minute since the message was postponed.
 160          if ( $time_passed < MINUTE_IN_SECONDS ) :
 161              $message = sprintf(
 162                  /* translators: %s: Human-readable time interval. */
 163                  __( 'The admin email verification page will reappear after %s.' ),
 164                  human_time_diff( time() + $remind_interval )
 165              );
 166              wp_admin_notice(
 167                  $message,
 168                  array(
 169                      'type'        => 'success',
 170                      'dismissible' => true,
 171                  )
 172              );
 173          endif;
 174      endif;
 175      ?>
 176  
 177  <?php
 178  if ( has_action( 'welcome_panel' ) && current_user_can( 'edit_theme_options' ) ) :
 179      $classes = 'welcome-panel';
 180  
 181      $option = (int) get_user_meta( get_current_user_id(), 'show_welcome_panel', true );
 182      // 0 = hide, 1 = toggled to show or single site creator, 2 = multisite site owner.
 183      $hide = ( 0 === $option || ( 2 === $option && wp_get_current_user()->user_email !== get_option( 'admin_email' ) ) );
 184      if ( $hide ) {
 185          $classes .= ' hidden';
 186      }
 187      ?>
 188  
 189      <div id="welcome-panel" class="<?php echo esc_attr( $classes ); ?>">
 190          <?php wp_nonce_field( 'welcome-panel-nonce', 'welcomepanelnonce', false ); ?>
 191          <a class="welcome-panel-close" href="<?php echo esc_url( admin_url( '?welcome=0' ) ); ?>" aria-label="<?php esc_attr_e( 'Dismiss the welcome panel' ); ?>"><?php _e( 'Dismiss' ); ?></a>
 192          <?php
 193          /**
 194           * Fires when adding content to the welcome panel on the admin dashboard.
 195           *
 196           * To remove the default welcome panel, use remove_action():
 197           *
 198           *     remove_action( 'welcome_panel', 'wp_welcome_panel' );
 199           *
 200           * @since 3.5.0
 201           */
 202          do_action( 'welcome_panel' );
 203          ?>
 204      </div>
 205  <?php endif; ?>
 206  
 207      <div id="dashboard-widgets-wrap">
 208      <?php wp_dashboard(); ?>
 209      </div><!-- dashboard-widgets-wrap -->
 210  
 211  </div><!-- wrap -->
 212  
 213  <?php
 214  wp_print_community_events_templates();
 215  
 216  require_once  ABSPATH . 'wp-admin/admin-footer.php';


Generated : Wed Nov 4 08:20:38 2026 Cross-referenced by PHPXref