3 * WordPress Dashboard Widget Administration Screen API
6 * @subpackage Administration
10 * Registers dashboard widgets.
12 * Handles POST data, sets up filters.
16 * @global array $wp_registered_widgets
17 * @global array $wp_registered_widget_controls
18 * @global array $wp_dashboard_control_callbacks
20 function wp_dashboard_setup() {
21 global $wp_registered_widgets, $wp_registered_widget_controls, $wp_dashboard_control_callbacks;
22 $wp_dashboard_control_callbacks = array();
23 $screen = get_current_screen();
25 /* Register Widgets and Controls */
27 $response = wp_check_browser_version();
29 if ( $response && $response['upgrade'] ) {
30 add_filter( 'postbox_classes_dashboard_dashboard_browser_nag', 'dashboard_browser_nag_class' );
31 if ( $response['insecure'] )
32 wp_add_dashboard_widget( 'dashboard_browser_nag', __( 'You are using an insecure browser!' ), 'wp_dashboard_browser_nag' );
34 wp_add_dashboard_widget( 'dashboard_browser_nag', __( 'Your browser is out of date!' ), 'wp_dashboard_browser_nag' );
38 if ( is_blog_admin() && current_user_can('edit_posts') )
39 wp_add_dashboard_widget( 'dashboard_right_now', __( 'At a Glance' ), 'wp_dashboard_right_now' );
41 if ( is_network_admin() )
42 wp_add_dashboard_widget( 'network_dashboard_right_now', __( 'Right Now' ), 'wp_network_dashboard_right_now' );
45 if ( is_blog_admin() ) {
46 wp_add_dashboard_widget( 'dashboard_activity', __( 'Activity' ), 'wp_dashboard_site_activity' );
50 if ( is_blog_admin() && current_user_can( get_post_type_object( 'post' )->cap->create_posts ) ) {
51 $quick_draft_title = sprintf( '<span class="hide-if-no-js">%1$s</span> <span class="hide-if-js">%2$s</span>', __( 'Quick Draft' ), __( 'Drafts' ) );
52 wp_add_dashboard_widget( 'dashboard_quick_press', $quick_draft_title, 'wp_dashboard_quick_press' );
56 wp_add_dashboard_widget( 'dashboard_primary', __( 'WordPress News' ), 'wp_dashboard_primary' );
58 if ( is_network_admin() ) {
61 * Fires after core widgets for the Network Admin dashboard have been registered.
65 do_action( 'wp_network_dashboard_setup' );
68 * Filters the list of widgets to load for the Network Admin dashboard.
72 * @param array $dashboard_widgets An array of dashboard widgets.
74 $dashboard_widgets = apply_filters( 'wp_network_dashboard_widgets', array() );
75 } elseif ( is_user_admin() ) {
78 * Fires after core widgets for the User Admin dashboard have been registered.
82 do_action( 'wp_user_dashboard_setup' );
85 * Filters the list of widgets to load for the User Admin dashboard.
89 * @param array $dashboard_widgets An array of dashboard widgets.
91 $dashboard_widgets = apply_filters( 'wp_user_dashboard_widgets', array() );
95 * Fires after core widgets for the admin dashboard have been registered.
99 do_action( 'wp_dashboard_setup' );
102 * Filters the list of widgets to load for the admin dashboard.
106 * @param array $dashboard_widgets An array of dashboard widgets.
108 $dashboard_widgets = apply_filters( 'wp_dashboard_widgets', array() );
111 foreach ( $dashboard_widgets as $widget_id ) {
112 $name = empty( $wp_registered_widgets[$widget_id]['all_link'] ) ? $wp_registered_widgets[$widget_id]['name'] : $wp_registered_widgets[$widget_id]['name'] . " <a href='{$wp_registered_widgets[$widget_id]['all_link']}' class='edit-box open-box'>" . __('View all') . '</a>';
113 wp_add_dashboard_widget( $widget_id, $name, $wp_registered_widgets[$widget_id]['callback'], $wp_registered_widget_controls[$widget_id]['callback'] );
116 if ( 'POST' == $_SERVER['REQUEST_METHOD'] && isset($_POST['widget_id']) ) {
117 check_admin_referer( 'edit-dashboard-widget_' . $_POST['widget_id'], 'dashboard-widget-nonce' );
118 ob_start(); // hack - but the same hack wp-admin/widgets.php uses
119 wp_dashboard_trigger_widget_control( $_POST['widget_id'] );
121 wp_redirect( remove_query_arg( 'edit' ) );
125 /** This action is documented in wp-admin/edit-form-advanced.php */
126 do_action( 'do_meta_boxes', $screen->id, 'normal', '' );
128 /** This action is documented in wp-admin/edit-form-advanced.php */
129 do_action( 'do_meta_boxes', $screen->id, 'side', '' );
133 * Adds a new dashboard widget.
137 * @global array $wp_dashboard_control_callbacks
139 * @param string $widget_id Widget ID (used in the 'id' attribute for the widget).
140 * @param string $widget_name Title of the widget.
141 * @param callable $callback Function that fills the widget with the desired content.
142 * The function should echo its output.
143 * @param callable $control_callback Optional. Function that outputs controls for the widget. Default null.
144 * @param array $callback_args Optional. Data that should be set as the $args property of the widget array
145 * (which is the second parameter passed to your callback). Default null.
147 function wp_add_dashboard_widget( $widget_id, $widget_name, $callback, $control_callback = null, $callback_args = null ) {
148 $screen = get_current_screen();
149 global $wp_dashboard_control_callbacks;
151 $private_callback_args = array( '__widget_basename' => $widget_name );
153 if ( is_null( $callback_args ) ) {
154 $callback_args = $private_callback_args;
155 } else if ( is_array( $callback_args ) ) {
156 $callback_args = array_merge( $callback_args, $private_callback_args );
159 if ( $control_callback && current_user_can( 'edit_dashboard' ) && is_callable( $control_callback ) ) {
160 $wp_dashboard_control_callbacks[$widget_id] = $control_callback;
161 if ( isset( $_GET['edit'] ) && $widget_id == $_GET['edit'] ) {
162 list($url) = explode( '#', add_query_arg( 'edit', false ), 2 );
163 $widget_name .= ' <span class="postbox-title-action"><a href="' . esc_url( $url ) . '">' . __( 'Cancel' ) . '</a></span>';
164 $callback = '_wp_dashboard_control_callback';
166 list($url) = explode( '#', add_query_arg( 'edit', $widget_id ), 2 );
167 $widget_name .= ' <span class="postbox-title-action"><a href="' . esc_url( "$url#$widget_id" ) . '" class="edit-box open-box">' . __( 'Configure' ) . '</a></span>';
171 $side_widgets = array( 'dashboard_quick_press', 'dashboard_primary' );
173 $location = 'normal';
174 if ( in_array($widget_id, $side_widgets) )
178 if ( 'dashboard_browser_nag' === $widget_id )
181 add_meta_box( $widget_id, $widget_name, $callback, $screen, $location, $priority, $callback_args );
185 * Outputs controls for the current dashboard widget.
190 * @param mixed $dashboard
191 * @param array $meta_box
193 function _wp_dashboard_control_callback( $dashboard, $meta_box ) {
194 echo '<form method="post" class="dashboard-widget-control-form">';
195 wp_dashboard_trigger_widget_control( $meta_box['id'] );
196 wp_nonce_field( 'edit-dashboard-widget_' . $meta_box['id'], 'dashboard-widget-nonce' );
197 echo '<input type="hidden" name="widget_id" value="' . esc_attr($meta_box['id']) . '" />';
198 submit_button( __('Submit') );
203 * Displays the dashboard.
207 function wp_dashboard() {
208 $screen = get_current_screen();
209 $columns = absint( $screen->get_columns() );
212 $columns_css = " columns-$columns";
216 <div id="dashboard-widgets" class="metabox-holder<?php echo $columns_css; ?>">
217 <div id="postbox-container-1" class="postbox-container">
218 <?php do_meta_boxes( $screen->id, 'normal', '' ); ?>
220 <div id="postbox-container-2" class="postbox-container">
221 <?php do_meta_boxes( $screen->id, 'side', '' ); ?>
223 <div id="postbox-container-3" class="postbox-container">
224 <?php do_meta_boxes( $screen->id, 'column3', '' ); ?>
226 <div id="postbox-container-4" class="postbox-container">
227 <?php do_meta_boxes( $screen->id, 'column4', '' ); ?>
232 wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false );
233 wp_nonce_field( 'meta-box-order', 'meta-box-order-nonce', false );
242 * Dashboard widget that displays some basic stats about the site.
244 * Formerly 'Right Now'. A streamlined 'At a Glance' as of 3.8.
248 function wp_dashboard_right_now() {
254 foreach ( array( 'post', 'page' ) as $post_type ) {
255 $num_posts = wp_count_posts( $post_type );
256 if ( $num_posts && $num_posts->publish ) {
257 if ( 'post' == $post_type ) {
258 $text = _n( '%s Post', '%s Posts', $num_posts->publish );
260 $text = _n( '%s Page', '%s Pages', $num_posts->publish );
262 $text = sprintf( $text, number_format_i18n( $num_posts->publish ) );
263 $post_type_object = get_post_type_object( $post_type );
264 if ( $post_type_object && current_user_can( $post_type_object->cap->edit_posts ) ) {
265 printf( '<li class="%1$s-count"><a href="edit.php?post_type=%1$s">%2$s</a></li>', $post_type, $text );
267 printf( '<li class="%1$s-count"><span>%2$s</span></li>', $post_type, $text );
273 $num_comm = wp_count_comments();
274 if ( $num_comm && ( $num_comm->approved || $num_comm->moderated ) ) {
275 $text = sprintf( _n( '%s Comment', '%s Comments', $num_comm->approved ), number_format_i18n( $num_comm->approved ) );
277 <li class="comment-count"><a href="edit-comments.php"><?php echo $text; ?></a></li>
279 $moderated_comments_count_i18n = number_format_i18n( $num_comm->moderated );
280 /* translators: Number of comments in moderation */
281 $text = sprintf( _nx( '%s in moderation', '%s in moderation', $num_comm->moderated, 'comments' ), $moderated_comments_count_i18n );
282 /* translators: Number of comments in moderation */
283 $aria_label = sprintf( _nx( '%s comment in moderation', '%s comments in moderation', $num_comm->moderated, 'comments' ), $moderated_comments_count_i18n );
285 <li class="comment-mod-count<?php
286 if ( ! $num_comm->moderated ) {
289 ?>"><a href="edit-comments.php?comment_status=moderated" aria-label="<?php esc_attr_e( $aria_label ); ?>"><?php echo $text; ?></a></li>
294 * Filters the array of extra elements to list in the 'At a Glance'
297 * Prior to 3.8.0, the widget was named 'Right Now'. Each element
298 * is wrapped in list-item tags on output.
302 * @param array $items Array of extra 'At a Glance' widget items.
304 $elements = apply_filters( 'dashboard_glance_items', array() );
307 echo '<li>' . implode( "</li>\n<li>", $elements ) . "</li>\n";
313 update_right_now_message();
315 // Check if search engines are asked not to index this site.
316 if ( ! is_network_admin() && ! is_user_admin() && current_user_can( 'manage_options' ) && '0' == get_option( 'blog_public' ) ) {
319 * Filters the link title attribute for the 'Search Engines Discouraged'
320 * message displayed in the 'At a Glance' dashboard widget.
322 * Prior to 3.8.0, the widget was named 'Right Now'.
325 * @since 4.5.0 The default for `$title` was updated to an empty string.
327 * @param string $title Default attribute text.
329 $title = apply_filters( 'privacy_on_link_title', '' );
332 * Filters the link label for the 'Search Engines Discouraged' message
333 * displayed in the 'At a Glance' dashboard widget.
335 * Prior to 3.8.0, the widget was named 'Right Now'.
339 * @param string $content Default text.
341 $content = apply_filters( 'privacy_on_link_text' , __( 'Search Engines Discouraged' ) );
342 $title_attr = '' === $title ? '' : " title='$title'";
344 echo "<p><a href='options-reading.php'$title_attr>$content</a></p>";
350 * activity_box_end has a core action, but only prints content when multisite.
351 * Using an output buffer is the only way to really check if anything's displayed here.
356 * Fires at the end of the 'At a Glance' dashboard widget.
358 * Prior to 3.8.0, the widget was named 'Right Now'.
362 do_action( 'rightnow_end' );
365 * Fires at the end of the 'At a Glance' dashboard widget.
367 * Prior to 3.8.0, the widget was named 'Right Now'.
371 do_action( 'activity_box_end' );
373 $actions = ob_get_clean();
375 if ( !empty( $actions ) ) : ?>
377 <?php echo $actions; ?>
385 function wp_network_dashboard_right_now() {
387 if ( current_user_can('create_sites') )
388 $actions['create-site'] = '<a href="' . network_admin_url('site-new.php') . '">' . __( 'Create a New Site' ) . '</a>';
389 if ( current_user_can('create_users') )
390 $actions['create-user'] = '<a href="' . network_admin_url('user-new.php') . '">' . __( 'Create a New User' ) . '</a>';
392 $c_users = get_user_count();
393 $c_blogs = get_blog_count();
395 $user_text = sprintf( _n( '%s user', '%s users', $c_users ), number_format_i18n( $c_users ) );
396 $blog_text = sprintf( _n( '%s site', '%s sites', $c_blogs ), number_format_i18n( $c_blogs ) );
398 $sentence = sprintf( __( 'You have %1$s and %2$s.' ), $blog_text, $user_text );
401 echo '<ul class="subsubsub">';
402 foreach ( $actions as $class => $action ) {
403 $actions[ $class ] = "\t<li class='$class'>$action";
405 echo implode( " |</li>\n", $actions ) . "</li>\n";
411 <p class="youhave"><?php echo $sentence; ?></p>
416 * Fires in the Network Admin 'Right Now' dashboard widget
417 * just before the user and site search form fields.
421 * @param null $unused
423 do_action( 'wpmuadminresult', '' );
426 <form action="<?php echo network_admin_url('users.php'); ?>" method="get">
428 <label class="screen-reader-text" for="search-users"><?php _e( 'Search Users' ); ?></label>
429 <input type="search" name="s" value="" size="30" autocomplete="off" id="search-users"/>
430 <?php submit_button( __( 'Search Users' ), 'button', false, false, array( 'id' => 'submit_users' ) ); ?>
434 <form action="<?php echo network_admin_url('sites.php'); ?>" method="get">
436 <label class="screen-reader-text" for="search-sites"><?php _e( 'Search Sites' ); ?></label>
437 <input type="search" name="s" value="" size="30" autocomplete="off" id="search-sites"/>
438 <?php submit_button( __( 'Search Sites' ), 'button', false, false, array( 'id' => 'submit_sites' ) ); ?>
443 * Fires at the end of the 'Right Now' widget in the Network Admin dashboard.
447 do_action( 'mu_rightnow_end' );
450 * Fires at the end of the 'Right Now' widget in the Network Admin dashboard.
454 do_action( 'mu_activity_box_end' );
458 * The Quick Draft widget display and creation of drafts.
462 * @global int $post_ID
464 * @param string $error_msg Optional. Error message. Default false.
466 function wp_dashboard_quick_press( $error_msg = false ) {
469 if ( ! current_user_can( 'edit_posts' ) ) {
473 /* Check if a new auto-draft (= no new post_ID) is needed or if the old can be used */
474 $last_post_id = (int) get_user_option( 'dashboard_quick_press_last_post_id' ); // Get the last post_ID
475 if ( $last_post_id ) {
476 $post = get_post( $last_post_id );
477 if ( empty( $post ) || $post->post_status != 'auto-draft' ) { // auto-draft doesn't exists anymore
478 $post = get_default_post_to_edit( 'post', true );
479 update_user_option( get_current_user_id(), 'dashboard_quick_press_last_post_id', (int) $post->ID ); // Save post_ID
481 $post->post_title = ''; // Remove the auto draft title
484 $post = get_default_post_to_edit( 'post' , true);
485 $user_id = get_current_user_id();
486 // Don't create an option if this is a super admin who does not belong to this site.
487 if ( ! ( is_super_admin( $user_id ) && ! in_array( get_current_blog_id(), array_keys( get_blogs_of_user( $user_id ) ) ) ) )
488 update_user_option( $user_id, 'dashboard_quick_press_last_post_id', (int) $post->ID ); // Save post_ID
491 $post_ID = (int) $post->ID;
494 <form name="post" action="<?php echo esc_url( admin_url( 'post.php' ) ); ?>" method="post" id="quick-press" class="initial-form hide-if-no-js">
496 <?php if ( $error_msg ) : ?>
497 <div class="error"><?php echo $error_msg; ?></div>
500 <div class="input-text-wrap" id="title-wrap">
501 <label class="screen-reader-text prompt" for="title" id="title-prompt-text">
504 /** This filter is documented in wp-admin/edit-form-advanced.php */
505 echo apply_filters( 'enter_title_here', __( 'Title' ), $post );
508 <input type="text" name="post_title" id="title" autocomplete="off" />
511 <div class="textarea-wrap" id="description-wrap">
512 <label class="screen-reader-text prompt" for="content" id="content-prompt-text"><?php _e( 'What’s on your mind?' ); ?></label>
513 <textarea name="content" id="content" class="mceEditor" rows="3" cols="15" autocomplete="off"></textarea>
517 <input type="hidden" name="action" id="quickpost-action" value="post-quickdraft-save" />
518 <input type="hidden" name="post_ID" value="<?php echo $post_ID; ?>" />
519 <input type="hidden" name="post_type" value="post" />
520 <?php wp_nonce_field( 'add-post' ); ?>
521 <?php submit_button( __( 'Save Draft' ), 'primary', 'save', false, array( 'id' => 'save-post' ) ); ?>
527 wp_dashboard_recent_drafts();
531 * Show recent drafts of the user on the dashboard.
535 * @param array $drafts
537 function wp_dashboard_recent_drafts( $drafts = false ) {
540 'post_type' => 'post',
541 'post_status' => 'draft',
542 'author' => get_current_user_id(),
543 'posts_per_page' => 4,
544 'orderby' => 'modified',
549 * Filters the post query arguments for the 'Recent Drafts' dashboard widget.
553 * @param array $query_args The query arguments for the 'Recent Drafts' dashboard widget.
555 $query_args = apply_filters( 'dashboard_recent_drafts_query_args', $query_args );
557 $drafts = get_posts( $query_args );
563 echo '<div class="drafts">';
564 if ( count( $drafts ) > 3 ) {
565 echo '<p class="view-all"><a href="' . esc_url( admin_url( 'edit.php?post_status=draft' ) ) . '" aria-label="' . __( 'View all drafts' ) . '">' . _x( 'View all', 'drafts' ) . "</a></p>\n";
567 echo '<h2 class="hide-if-no-js">' . __( 'Drafts' ) . "</h2>\n<ul>";
569 $drafts = array_slice( $drafts, 0, 3 );
570 foreach ( $drafts as $draft ) {
571 $url = get_edit_post_link( $draft->ID );
572 $title = _draft_or_post_title( $draft->ID );
574 /* translators: %s: post title */
575 echo '<div class="draft-title"><a href="' . esc_url( $url ) . '" aria-label="' . esc_attr( sprintf( __( 'Edit “%s”' ), $title ) ) . '">' . esc_html( $title ) . '</a>';
576 echo '<time datetime="' . get_the_time( 'c', $draft ) . '">' . get_the_time( __( 'F j, Y' ), $draft ) . '</time></div>';
577 if ( $the_content = wp_trim_words( $draft->post_content, 10 ) ) {
578 echo '<p>' . $the_content . '</p>';
582 echo "</ul>\n</div>";
586 * Outputs a row for the Recent Comments widget.
591 * @global WP_Comment $comment
593 * @param WP_Comment $comment The current comment.
594 * @param bool $show_date Optional. Whether to display the date.
596 function _wp_dashboard_recent_comments_row( &$comment, $show_date = true ) {
597 $GLOBALS['comment'] = clone $comment;
599 if ( $comment->comment_post_ID > 0 ) {
601 $comment_post_title = _draft_or_post_title( $comment->comment_post_ID );
602 $comment_post_url = get_the_permalink( $comment->comment_post_ID );
603 $comment_post_link = "<a href='$comment_post_url'>$comment_post_title</a>";
605 $comment_post_link = '';
608 $actions_string = '';
609 if ( current_user_can( 'edit_comment', $comment->comment_ID ) ) {
610 // Pre-order it: Approve | Reply | Edit | Spam | Trash.
612 'approve' => '', 'unapprove' => '',
616 'trash' => '', 'delete' => '',
620 $del_nonce = esc_html( '_wpnonce=' . wp_create_nonce( "delete-comment_$comment->comment_ID" ) );
621 $approve_nonce = esc_html( '_wpnonce=' . wp_create_nonce( "approve-comment_$comment->comment_ID" ) );
623 $approve_url = esc_url( "comment.php?action=approvecomment&p=$comment->comment_post_ID&c=$comment->comment_ID&$approve_nonce" );
624 $unapprove_url = esc_url( "comment.php?action=unapprovecomment&p=$comment->comment_post_ID&c=$comment->comment_ID&$approve_nonce" );
625 $spam_url = esc_url( "comment.php?action=spamcomment&p=$comment->comment_post_ID&c=$comment->comment_ID&$del_nonce" );
626 $trash_url = esc_url( "comment.php?action=trashcomment&p=$comment->comment_post_ID&c=$comment->comment_ID&$del_nonce" );
627 $delete_url = esc_url( "comment.php?action=deletecomment&p=$comment->comment_post_ID&c=$comment->comment_ID&$del_nonce" );
629 $actions['approve'] = "<a href='$approve_url' data-wp-lists='dim:the-comment-list:comment-$comment->comment_ID:unapproved:e7e7d3:e7e7d3:new=approved' class='vim-a' aria-label='" . esc_attr__( 'Approve this comment' ) . "'>" . __( 'Approve' ) . '</a>';
630 $actions['unapprove'] = "<a href='$unapprove_url' data-wp-lists='dim:the-comment-list:comment-$comment->comment_ID:unapproved:e7e7d3:e7e7d3:new=unapproved' class='vim-u' aria-label='" . esc_attr__( 'Unapprove this comment' ) . "'>" . __( 'Unapprove' ) . '</a>';
631 $actions['edit'] = "<a href='comment.php?action=editcomment&c={$comment->comment_ID}' aria-label='" . esc_attr__( 'Edit this comment' ) . "'>". __( 'Edit' ) . '</a>';
632 $actions['reply'] = '<a onclick="window.commentReply && commentReply.open(\'' . $comment->comment_ID . '\',\''.$comment->comment_post_ID.'\');return false;" class="vim-r hide-if-no-js" aria-label="' . esc_attr__( 'Reply to this comment' ) . '" href="#">' . __( 'Reply' ) . '</a>';
633 $actions['spam'] = "<a href='$spam_url' data-wp-lists='delete:the-comment-list:comment-$comment->comment_ID::spam=1' class='vim-s vim-destructive' aria-label='" . esc_attr__( 'Mark this comment as spam' ) . "'>" . /* translators: mark as spam link */ _x( 'Spam', 'verb' ) . '</a>';
635 if ( ! EMPTY_TRASH_DAYS ) {
636 $actions['delete'] = "<a href='$delete_url' data-wp-lists='delete:the-comment-list:comment-$comment->comment_ID::trash=1' class='delete vim-d vim-destructive' aria-label='" . esc_attr__( 'Delete this comment permanently' ) . "'>" . __( 'Delete Permanently' ) . '</a>';
638 $actions['trash'] = "<a href='$trash_url' data-wp-lists='delete:the-comment-list:comment-$comment->comment_ID::trash=1' class='delete vim-d vim-destructive' aria-label='" . esc_attr__( 'Move this comment to the Trash' ) . "'>" . _x( 'Trash', 'verb' ) . '</a>';
641 $actions['view'] = '<a class="comment-link" href="' . esc_url( get_comment_link( $comment ) ) . '" aria-label="' . esc_attr__( 'View this comment' ) . '">' . __( 'View' ) . '</a>';
644 * Filters the action links displayed for each comment in the 'Recent Comments'
649 * @param array $actions An array of comment actions. Default actions include:
650 * 'Approve', 'Unapprove', 'Edit', 'Reply', 'Spam',
651 * 'Delete', and 'Trash'.
652 * @param WP_Comment $comment The comment object.
654 $actions = apply_filters( 'comment_row_actions', array_filter($actions), $comment );
657 foreach ( $actions as $action => $link ) {
659 ( ( ('approve' == $action || 'unapprove' == $action) && 2 === $i ) || 1 === $i ) ? $sep = '' : $sep = ' | ';
661 // Reply and quickedit need a hide-if-no-js span
662 if ( 'reply' == $action || 'quickedit' == $action ) {
663 $action .= ' hide-if-no-js';
666 if ( 'view' === $action && '1' !== $comment->comment_approved ) {
667 $action .= ' hidden';
669 $actions_string .= "<span class='$action'>$sep$link</span>";
674 <li id="comment-<?php echo $comment->comment_ID; ?>" <?php comment_class( array( 'comment-item', wp_get_comment_status( $comment ) ), $comment ); ?>>
676 <?php echo get_avatar( $comment, 50, 'mystery' ); ?>
678 <?php if ( !$comment->comment_type || 'comment' == $comment->comment_type ) : ?>
680 <div class="dashboard-comment-wrap has-row-actions">
681 <p class="comment-meta">
683 // Comments might not have a post they relate to, e.g. programmatically created ones.
684 if ( $comment_post_link ) {
686 /* translators: 1: comment author, 2: post link, 3: notification if the comment is pending */
687 __( 'From %1$s on %2$s %3$s' ),
688 '<cite class="comment-author">' . get_comment_author_link( $comment ) . '</cite>',
690 '<span class="approve">' . __( '[Pending]' ) . '</span>'
694 /* translators: 1: comment author, 2: notification if the comment is pending */
695 __( 'From %1$s %2$s' ),
696 '<cite class="comment-author">' . get_comment_author_link( $comment ) . '</cite>',
697 '<span class="approve">' . __( '[Pending]' ) . '</span>'
705 switch ( $comment->comment_type ) {
707 $type = __( 'Pingback' );
710 $type = __( 'Trackback' );
713 $type = ucwords( $comment->comment_type );
715 $type = esc_html( $type );
717 <div class="dashboard-comment-wrap has-row-actions">
718 <p class="comment-meta">
720 // Pingbacks, Trackbacks or custom comment types might not have a post they relate to, e.g. programmatically created ones.
721 if ( $comment_post_link ) {
723 /* translators: 1: type of comment, 2: post link, 3: notification if the comment is pending */
724 _x( '%1$s on %2$s %3$s', 'dashboard' ),
725 "<strong>$type</strong>",
727 '<span class="approve">' . __( '[Pending]' ) . '</span>'
731 /* translators: 1: type of comment, 2: notification if the comment is pending */
732 _x( '%1$s %2$s', 'dashboard' ),
733 "<strong>$type</strong>",
734 '<span class="approve">' . __( '[Pending]' ) . '</span>'
739 <p class="comment-author"><?php comment_author_link( $comment ); ?></p>
741 <?php endif; // comment_type ?>
742 <blockquote><p><?php comment_excerpt( $comment ); ?></p></blockquote>
743 <?php if ( $actions_string ) : ?>
744 <p class="row-actions"><?php echo $actions_string; ?></p>
749 $GLOBALS['comment'] = null;
753 * Callback function for Activity widget.
757 function wp_dashboard_site_activity() {
759 echo '<div id="activity-widget">';
761 $future_posts = wp_dashboard_recent_posts( array(
763 'status' => 'future',
765 'title' => __( 'Publishing Soon' ),
766 'id' => 'future-posts',
768 $recent_posts = wp_dashboard_recent_posts( array(
770 'status' => 'publish',
772 'title' => __( 'Recently Published' ),
773 'id' => 'published-posts',
776 $recent_comments = wp_dashboard_recent_comments();
778 if ( !$future_posts && !$recent_posts && !$recent_comments ) {
779 echo '<div class="no-activity">';
780 echo '<p class="smiley"></p>';
781 echo '<p>' . __( 'No activity yet!' ) . '</p>';
789 * Generates Publishing Soon and Recently Published sections.
793 * @param array $args {
794 * An array of query and display arguments.
796 * @type int $max Number of posts to display.
797 * @type string $status Post status.
798 * @type string $order Designates ascending ('ASC') or descending ('DESC') order.
799 * @type string $title Section title.
800 * @type string $id The container id.
802 * @return bool False if no posts were found. True otherwise.
804 function wp_dashboard_recent_posts( $args ) {
806 'post_type' => 'post',
807 'post_status' => $args['status'],
809 'order' => $args['order'],
810 'posts_per_page' => intval( $args['max'] ),
811 'no_found_rows' => true,
812 'cache_results' => false,
813 'perm' => ( 'future' === $args['status'] ) ? 'editable' : 'readable',
817 * Filters the query arguments used for the Recent Posts widget.
821 * @param array $query_args The arguments passed to WP_Query to produce the list of posts.
823 $query_args = apply_filters( 'dashboard_recent_posts_query_args', $query_args );
824 $posts = new WP_Query( $query_args );
826 if ( $posts->have_posts() ) {
828 echo '<div id="' . $args['id'] . '" class="activity-block">';
830 echo '<h3>' . $args['title'] . '</h3>';
834 $today = date( 'Y-m-d', current_time( 'timestamp' ) );
835 $tomorrow = date( 'Y-m-d', strtotime( '+1 day', current_time( 'timestamp' ) ) );
837 while ( $posts->have_posts() ) {
840 $time = get_the_time( 'U' );
841 if ( date( 'Y-m-d', $time ) == $today ) {
842 $relative = __( 'Today' );
843 } elseif ( date( 'Y-m-d', $time ) == $tomorrow ) {
844 $relative = __( 'Tomorrow' );
845 } elseif ( date( 'Y', $time ) !== date( 'Y', current_time( 'timestamp' ) ) ) {
846 /* translators: date and time format for recent posts on the dashboard, from a different calendar year, see https://secure.php.net/date */
847 $relative = date_i18n( __( 'M jS Y' ), $time );
849 /* translators: date and time format for recent posts on the dashboard, see https://secure.php.net/date */
850 $relative = date_i18n( __( 'M jS' ), $time );
853 // Use the post edit link for those who can edit, the permalink otherwise.
854 $recent_post_link = current_user_can( 'edit_post', get_the_ID() ) ? get_edit_post_link() : get_permalink();
856 $draft_or_post_title = _draft_or_post_title();
858 '<li><span>%1$s</span> <a href="%2$s" aria-label="%3$s">%4$s</a></li>',
859 /* translators: 1: relative date, 2: time */
860 sprintf( _x( '%1$s, %2$s', 'dashboard' ), $relative, get_the_time() ),
862 /* translators: %s: post title */
863 esc_attr( sprintf( __( 'Edit “%s”' ), $draft_or_post_title ) ),
881 * Show Comments section.
885 * @param int $total_items Optional. Number of comments to query. Default 5.
886 * @return bool False if no comments were found. True otherwise.
888 function wp_dashboard_recent_comments( $total_items = 5 ) {
889 // Select all comment types and filter out spam later for better query performance.
892 $comments_query = array(
893 'number' => $total_items * 5,
896 if ( ! current_user_can( 'edit_posts' ) )
897 $comments_query['status'] = 'approve';
899 while ( count( $comments ) < $total_items && $possible = get_comments( $comments_query ) ) {
900 if ( ! is_array( $possible ) ) {
903 foreach ( $possible as $comment ) {
904 if ( ! current_user_can( 'read_post', $comment->comment_post_ID ) )
906 $comments[] = $comment;
907 if ( count( $comments ) == $total_items )
910 $comments_query['offset'] += $comments_query['number'];
911 $comments_query['number'] = $total_items * 10;
915 echo '<div id="latest-comments" class="activity-block">';
916 echo '<h3>' . __( 'Recent Comments' ) . '</h3>';
918 echo '<ul id="the-comment-list" data-wp-lists="list:comment">';
919 foreach ( $comments as $comment )
920 _wp_dashboard_recent_comments_row( $comment );
923 if ( current_user_can( 'edit_posts' ) ) {
924 echo '<h3 class="screen-reader-text">' . __( 'View more comments' ) . '</h3>';
925 _get_list_table( 'WP_Comments_List_Table' )->views();
928 wp_comment_reply( -1, false, 'dashboard', false );
929 wp_comment_trashnotice();
939 * Display generic dashboard RSS widget feed.
943 * @param string $widget_id
945 function wp_dashboard_rss_output( $widget_id ) {
946 $widgets = get_option( 'dashboard_widget_options' );
947 echo '<div class="rss-widget">';
948 wp_widget_rss_output( $widgets[ $widget_id ] );
953 * Checks to see if all of the feed url in $check_urls are cached.
955 * If $check_urls is empty, look for the rss feed url found in the dashboard
956 * widget options of $widget_id. If cached, call $callback, a function that
957 * echoes out output for this widget. If not cache, echo a "Loading..." stub
958 * which is later replaced by Ajax call (see top of /wp-admin/index.php)
962 * @param string $widget_id
963 * @param callable $callback
964 * @param array $check_urls RSS feeds
965 * @return bool False on failure. True on success.
967 function wp_dashboard_cached_rss_widget( $widget_id, $callback, $check_urls = array() ) {
968 $loading = '<p class="widget-loading hide-if-no-js">' . __( 'Loading…' ) . '</p><p class="hide-if-js">' . __( 'This widget requires JavaScript.' ) . '</p>';
969 $doing_ajax = ( defined('DOING_AJAX') && DOING_AJAX );
971 if ( empty($check_urls) ) {
972 $widgets = get_option( 'dashboard_widget_options' );
973 if ( empty($widgets[$widget_id]['url']) && ! $doing_ajax ) {
977 $check_urls = array( $widgets[$widget_id]['url'] );
980 $locale = get_locale();
981 $cache_key = 'dash_' . md5( $widget_id . '_' . $locale );
982 if ( false !== ( $output = get_transient( $cache_key ) ) ) {
987 if ( ! $doing_ajax ) {
992 if ( $callback && is_callable( $callback ) ) {
993 $args = array_slice( func_get_args(), 3 );
994 array_unshift( $args, $widget_id, $check_urls );
996 call_user_func_array( $callback, $args );
997 set_transient( $cache_key, ob_get_flush(), 12 * HOUR_IN_SECONDS ); // Default lifetime in cache of 12 hours (same as the feeds)
1004 // Dashboard Widgets Controls
1008 * Calls widget control callback.
1012 * @global array $wp_dashboard_control_callbacks
1014 * @param int $widget_control_id Registered Widget ID.
1016 function wp_dashboard_trigger_widget_control( $widget_control_id = false ) {
1017 global $wp_dashboard_control_callbacks;
1019 if ( is_scalar($widget_control_id) && $widget_control_id && isset($wp_dashboard_control_callbacks[$widget_control_id]) && is_callable($wp_dashboard_control_callbacks[$widget_control_id]) ) {
1020 call_user_func( $wp_dashboard_control_callbacks[$widget_control_id], '', array( 'id' => $widget_control_id, 'callback' => $wp_dashboard_control_callbacks[$widget_control_id] ) );
1025 * The RSS dashboard widget control.
1027 * Sets up $args to be used as input to wp_widget_rss_form(). Handles POST data
1028 * from RSS-type widgets.
1032 * @param string $widget_id
1033 * @param array $form_inputs
1035 function wp_dashboard_rss_control( $widget_id, $form_inputs = array() ) {
1036 if ( !$widget_options = get_option( 'dashboard_widget_options' ) )
1037 $widget_options = array();
1039 if ( !isset($widget_options[$widget_id]) )
1040 $widget_options[$widget_id] = array();
1042 $number = 1; // Hack to use wp_widget_rss_form()
1043 $widget_options[$widget_id]['number'] = $number;
1045 if ( 'POST' == $_SERVER['REQUEST_METHOD'] && isset($_POST['widget-rss'][$number]) ) {
1046 $_POST['widget-rss'][$number] = wp_unslash( $_POST['widget-rss'][$number] );
1047 $widget_options[$widget_id] = wp_widget_rss_process( $_POST['widget-rss'][$number] );
1048 $widget_options[$widget_id]['number'] = $number;
1050 // Title is optional. If black, fill it if possible.
1051 if ( !$widget_options[$widget_id]['title'] && isset($_POST['widget-rss'][$number]['title']) ) {
1052 $rss = fetch_feed($widget_options[$widget_id]['url']);
1053 if ( is_wp_error($rss) ) {
1054 $widget_options[$widget_id]['title'] = htmlentities(__('Unknown Feed'));
1056 $widget_options[$widget_id]['title'] = htmlentities(strip_tags($rss->get_title()));
1061 update_option( 'dashboard_widget_options', $widget_options );
1062 $cache_key = 'dash_' . md5( $widget_id );
1063 delete_transient( $cache_key );
1066 wp_widget_rss_form( $widget_options[$widget_id], $form_inputs );
1070 * WordPress News dashboard widget.
1074 function wp_dashboard_primary() {
1079 * Filters the primary link URL for the 'WordPress News' dashboard widget.
1083 * @param string $link The widget's primary link URL.
1085 'link' => apply_filters( 'dashboard_primary_link', __( 'https://wordpress.org/news/' ) ),
1088 * Filters the primary feed URL for the 'WordPress News' dashboard widget.
1092 * @param string $url The widget's primary feed URL.
1094 'url' => apply_filters( 'dashboard_primary_feed', __( 'http://wordpress.org/news/feed/' ) ),
1097 * Filters the primary link title for the 'WordPress News' dashboard widget.
1101 * @param string $title Title attribute for the widget's primary link.
1103 'title' => apply_filters( 'dashboard_primary_title', __( 'WordPress Blog' ) ),
1105 'show_summary' => 1,
1112 * Filters the secondary link URL for the 'WordPress News' dashboard widget.
1116 * @param string $link The widget's secondary link URL.
1118 'link' => apply_filters( 'dashboard_secondary_link', __( 'https://planet.wordpress.org/' ) ),
1121 * Filters the secondary feed URL for the 'WordPress News' dashboard widget.
1125 * @param string $url The widget's secondary feed URL.
1127 'url' => apply_filters( 'dashboard_secondary_feed', __( 'https://planet.wordpress.org/feed/' ) ),
1130 * Filters the secondary link title for the 'WordPress News' dashboard widget.
1134 * @param string $title Title attribute for the widget's secondary link.
1136 'title' => apply_filters( 'dashboard_secondary_title', __( 'Other WordPress News' ) ),
1139 * Filters the number of secondary link items for the 'WordPress News' dashboard widget.
1143 * @param string $items How many items to show in the secondary feed.
1145 'items' => apply_filters( 'dashboard_secondary_items', 3 ),
1146 'show_summary' => 0,
1152 if ( ( ! is_multisite() && is_blog_admin() && current_user_can( 'install_plugins' ) ) || ( is_network_admin() && current_user_can( 'manage_network_plugins' ) && current_user_can( 'install_plugins' ) ) ) {
1153 $feeds['plugins'] = array(
1156 'popular' => 'http://wordpress.org/plugins/rss/browse/popular/',
1160 'show_summary' => 0,
1166 wp_dashboard_cached_rss_widget( 'dashboard_primary', 'wp_dashboard_primary_output', $feeds );
1170 * Display the WordPress news feeds.
1174 * @param string $widget_id Widget ID.
1175 * @param array $feeds Array of RSS feeds.
1177 function wp_dashboard_primary_output( $widget_id, $feeds ) {
1178 foreach ( $feeds as $type => $args ) {
1179 $args['type'] = $type;
1180 echo '<div class="rss-widget">';
1181 if ( $type === 'plugins' ) {
1182 wp_dashboard_plugins_output( $args['url'], $args );
1184 wp_widget_rss_output( $args['url'], $args );
1191 * Display plugins text for the WordPress news widget.
1195 * @param string $rss The RSS feed URL.
1196 * @param array $args Array of arguments for this RSS feed.
1198 function wp_dashboard_plugins_output( $rss, $args = array() ) {
1199 // Plugin feeds plus link to install them
1200 $popular = fetch_feed( $args['url']['popular'] );
1202 if ( false === $plugin_slugs = get_transient( 'plugin_slugs' ) ) {
1203 $plugin_slugs = array_keys( get_plugins() );
1204 set_transient( 'plugin_slugs', $plugin_slugs, DAY_IN_SECONDS );
1209 foreach ( array( $popular ) as $feed ) {
1210 if ( is_wp_error( $feed ) || ! $feed->get_item_quantity() )
1213 $items = $feed->get_items(0, 5);
1215 // Pick a random, non-installed plugin
1217 // Abort this foreach loop iteration if there's no plugins left of this type
1218 if ( 0 == count($items) )
1221 $item_key = array_rand($items);
1222 $item = $items[$item_key];
1224 list($link, $frag) = explode( '#', $item->get_link() );
1226 $link = esc_url($link);
1227 if ( preg_match( '|/([^/]+?)/?$|', $link, $matches ) )
1228 $slug = $matches[1];
1230 unset( $items[$item_key] );
1234 // Is this random plugin's slug already installed? If so, try again.
1235 reset( $plugin_slugs );
1236 foreach ( $plugin_slugs as $plugin_slug ) {
1237 if ( $slug == substr( $plugin_slug, 0, strlen( $slug ) ) ) {
1238 unset( $items[$item_key] );
1243 // If we get to this point, then the random plugin isn't installed and we can stop the while().
1247 // Eliminate some common badly formed plugin descriptions
1248 while ( ( null !== $item_key = array_rand($items) ) && false !== strpos( $items[$item_key]->get_description(), 'Plugin Name:' ) )
1249 unset($items[$item_key]);
1251 if ( !isset($items[$item_key]) )
1254 $raw_title = $item->get_title();
1256 $ilink = wp_nonce_url('plugin-install.php?tab=plugin-information&plugin=' . $slug, 'install-plugin_' . $slug) . '&TB_iframe=true&width=600&height=800';
1257 echo '<li class="dashboard-news-plugin"><span>' . __( 'Popular Plugin' ) . ':</span> ' . esc_html( $raw_title ) .
1258 ' <a href="' . $ilink . '" class="thickbox open-plugin-details-modal" aria-label="' .
1259 /* translators: %s: plugin name */
1260 esc_attr( sprintf( __( 'Install %s' ), $raw_title ) ) . '">(' . __( 'Install' ) . ')</a></li>';
1262 $feed->__destruct();
1270 * Display file upload quota on dashboard.
1272 * Runs on the {@see 'activity_box_end'} hook in wp_dashboard_right_now().
1276 * @return bool|null True if not multisite, user can't upload files, or the space check option is disabled.
1278 function wp_dashboard_quota() {
1279 if ( !is_multisite() || !current_user_can( 'upload_files' ) || get_site_option( 'upload_space_check_disabled' ) )
1282 $quota = get_space_allowed();
1283 $used = get_space_used();
1285 if ( $used > $quota )
1286 $percentused = '100';
1288 $percentused = ( $used / $quota ) * 100;
1289 $used_class = ( $percentused >= 70 ) ? ' warning' : '';
1290 $used = round( $used, 2 );
1291 $percentused = number_format( $percentused );
1294 <h3 class="mu-storage"><?php _e( 'Storage Space' ); ?></h3>
1295 <div class="mu-storage">
1297 <li class="storage-count">
1298 <?php $text = sprintf(
1299 /* translators: number of megabytes */
1300 __( '%s MB Space Allowed' ),
1301 number_format_i18n( $quota )
1304 '<a href="%1$s">%2$s <span class="screen-reader-text">(%3$s)</span></a>',
1305 esc_url( admin_url( 'upload.php' ) ),
1307 __( 'Manage Uploads' )
1309 </li><li class="storage-count <?php echo $used_class; ?>">
1310 <?php $text = sprintf(
1311 /* translators: 1: number of megabytes, 2: percentage */
1312 __( '%1$s MB (%2$s%%) Space Used' ),
1313 number_format_i18n( $used, 2 ),
1317 '<a href="%1$s" class="musublink">%2$s <span class="screen-reader-text">(%3$s)</span></a>',
1318 esc_url( admin_url( 'upload.php' ) ),
1320 __( 'Manage Uploads' )
1328 // Display Browser Nag Meta Box
1329 function wp_dashboard_browser_nag() {
1331 $response = wp_check_browser_version();
1334 if ( $response['insecure'] ) {
1335 /* translators: %s: browser name and link */
1336 $msg = sprintf( __( "It looks like you're using an insecure version of %s. Using an outdated browser makes your computer unsafe. For the best WordPress experience, please update your browser." ),
1337 sprintf( '<a href="%s">%s</a>', esc_url( $response['update_url'] ), esc_html( $response['name'] ) )
1340 /* translators: %s: browser name and link */
1341 $msg = sprintf( __( "It looks like you're using an old version of %s. For the best WordPress experience, please update your browser." ),
1342 sprintf( '<a href="%s">%s</a>', esc_url( $response['update_url'] ), esc_html( $response['name'] ) )
1346 $browser_nag_class = '';
1347 if ( !empty( $response['img_src'] ) ) {
1348 $img_src = ( is_ssl() && ! empty( $response['img_src_ssl'] ) )? $response['img_src_ssl'] : $response['img_src'];
1350 $notice .= '<div class="alignright browser-icon"><a href="' . esc_attr($response['update_url']) . '"><img src="' . esc_attr( $img_src ) . '" alt="" /></a></div>';
1351 $browser_nag_class = ' has-browser-icon';
1353 $notice .= "<p class='browser-update-nag{$browser_nag_class}'>{$msg}</p>";
1355 $browsehappy = 'http://browsehappy.com/';
1356 $locale = get_locale();
1357 if ( 'en_US' !== $locale )
1358 $browsehappy = add_query_arg( 'locale', $locale, $browsehappy );
1360 $notice .= '<p>' . sprintf( __( '<a href="%1$s" class="update-browser-link">Update %2$s</a> or learn how to <a href="%3$s" class="browse-happy-link">browse happy</a>' ), esc_attr( $response['update_url'] ), esc_html( $response['name'] ), esc_url( $browsehappy ) ) . '</p>';
1361 $notice .= '<p class="hide-if-no-js"><a href="" class="dismiss" aria-label="' . esc_attr__( 'Dismiss the browser warning panel' ) . '">' . __( 'Dismiss' ) . '</a></p>';
1362 $notice .= '<div class="clear"></div>';
1366 * Filters the notice output for the 'Browse Happy' nag meta box.
1370 * @param string $notice The notice content.
1371 * @param array $response An array containing web browser information.
1373 echo apply_filters( 'browse-happy-notice', $notice, $response );
1379 * @param array $classes
1382 function dashboard_browser_nag_class( $classes ) {
1383 $response = wp_check_browser_version();
1385 if ( $response && $response['insecure'] )
1386 $classes[] = 'browser-insecure';
1392 * Check if the user needs a browser update
1396 * @global string $wp_version
1398 * @return array|bool False on failure, array of browser data on success.
1400 function wp_check_browser_version() {
1401 if ( empty( $_SERVER['HTTP_USER_AGENT'] ) )
1404 $key = md5( $_SERVER['HTTP_USER_AGENT'] );
1406 if ( false === ($response = get_site_transient('browser_' . $key) ) ) {
1410 'body' => array( 'useragent' => $_SERVER['HTTP_USER_AGENT'] ),
1411 'user-agent' => 'WordPress/' . $wp_version . '; ' . home_url()
1414 $response = wp_remote_post( 'http://api.wordpress.org/core/browse-happy/1.1/', $options );
1416 if ( is_wp_error( $response ) || 200 != wp_remote_retrieve_response_code( $response ) )
1420 * Response should be an array with:
1421 * 'name' - string - A user friendly browser name
1422 * 'version' - string - The version of the browser the user is using
1423 * 'current_version' - string - The most recent version of the browser
1424 * 'upgrade' - boolean - Whether the browser needs an upgrade
1425 * 'insecure' - boolean - Whether the browser is deemed insecure
1426 * 'upgrade_url' - string - The url to visit to upgrade
1427 * 'img_src' - string - An image representing the browser
1428 * 'img_src_ssl' - string - An image (over SSL) representing the browser
1430 $response = json_decode( wp_remote_retrieve_body( $response ), true );
1432 if ( ! is_array( $response ) )
1435 set_site_transient( 'browser_' . $key, $response, WEEK_IN_SECONDS );
1442 * Empty function usable by plugins to output empty dashboard widget (to be populated later by JS).
1444 function wp_dashboard_empty() {}
1447 * Displays a welcome panel to introduce users to WordPress.
1451 function wp_welcome_panel() {
1453 <div class="welcome-panel-content">
1454 <h2><?php _e( 'Welcome to WordPress!' ); ?></h2>
1455 <p class="about-description"><?php _e( 'We’ve assembled some links to get you started:' ); ?></p>
1456 <div class="welcome-panel-column-container">
1457 <div class="welcome-panel-column">
1458 <?php if ( current_user_can( 'customize' ) ): ?>
1459 <h3><?php _e( 'Get Started' ); ?></h3>
1460 <a class="button button-primary button-hero load-customize hide-if-no-customize" href="<?php echo wp_customize_url(); ?>"><?php _e( 'Customize Your Site' ); ?></a>
1462 <a class="button button-primary button-hero hide-if-customize" href="<?php echo admin_url( 'themes.php' ); ?>"><?php _e( 'Customize Your Site' ); ?></a>
1463 <?php if ( current_user_can( 'install_themes' ) || ( current_user_can( 'switch_themes' ) && count( wp_get_themes( array( 'allowed' => true ) ) ) > 1 ) ) : ?>
1464 <p class="hide-if-no-customize"><?php printf( __( 'or, <a href="%s">change your theme completely</a>' ), admin_url( 'themes.php' ) ); ?></p>
1467 <div class="welcome-panel-column">
1468 <h3><?php _e( 'Next Steps' ); ?></h3>
1470 <?php if ( 'page' == get_option( 'show_on_front' ) && ! get_option( 'page_for_posts' ) ) : ?>
1471 <li><?php printf( '<a href="%s" class="welcome-icon welcome-edit-page">' . __( 'Edit your front page' ) . '</a>', get_edit_post_link( get_option( 'page_on_front' ) ) ); ?></li>
1472 <li><?php printf( '<a href="%s" class="welcome-icon welcome-add-page">' . __( 'Add additional pages' ) . '</a>', admin_url( 'post-new.php?post_type=page' ) ); ?></li>
1473 <?php elseif ( 'page' == get_option( 'show_on_front' ) ) : ?>
1474 <li><?php printf( '<a href="%s" class="welcome-icon welcome-edit-page">' . __( 'Edit your front page' ) . '</a>', get_edit_post_link( get_option( 'page_on_front' ) ) ); ?></li>
1475 <li><?php printf( '<a href="%s" class="welcome-icon welcome-add-page">' . __( 'Add additional pages' ) . '</a>', admin_url( 'post-new.php?post_type=page' ) ); ?></li>
1476 <li><?php printf( '<a href="%s" class="welcome-icon welcome-write-blog">' . __( 'Add a blog post' ) . '</a>', admin_url( 'post-new.php' ) ); ?></li>
1478 <li><?php printf( '<a href="%s" class="welcome-icon welcome-write-blog">' . __( 'Write your first blog post' ) . '</a>', admin_url( 'post-new.php' ) ); ?></li>
1479 <li><?php printf( '<a href="%s" class="welcome-icon welcome-add-page">' . __( 'Add an About page' ) . '</a>', admin_url( 'post-new.php?post_type=page' ) ); ?></li>
1481 <li><?php printf( '<a href="%s" class="welcome-icon welcome-view-site">' . __( 'View your site' ) . '</a>', home_url( '/' ) ); ?></li>
1484 <div class="welcome-panel-column welcome-panel-last">
1485 <h3><?php _e( 'More Actions' ); ?></h3>
1487 <?php if ( current_theme_supports( 'widgets' ) || current_theme_supports( 'menus' ) ) : ?>
1488 <li><div class="welcome-icon welcome-widgets-menus"><?php
1489 if ( current_theme_supports( 'widgets' ) && current_theme_supports( 'menus' ) ) {
1490 printf( __( 'Manage <a href="%1$s">widgets</a> or <a href="%2$s">menus</a>' ),
1491 admin_url( 'widgets.php' ), admin_url( 'nav-menus.php' ) );
1492 } elseif ( current_theme_supports( 'widgets' ) ) {
1493 echo '<a href="' . admin_url( 'widgets.php' ) . '">' . __( 'Manage widgets' ) . '</a>';
1495 echo '<a href="' . admin_url( 'nav-menus.php' ) . '">' . __( 'Manage menus' ) . '</a>';
1499 <?php if ( current_user_can( 'manage_options' ) ) : ?>
1500 <li><?php printf( '<a href="%s" class="welcome-icon welcome-comments">' . __( 'Turn comments on or off' ) . '</a>', admin_url( 'options-discussion.php' ) ); ?></li>
1502 <li><?php printf( '<a href="%s" class="welcome-icon welcome-learn-more">' . __( 'Learn more about getting started' ) . '</a>', __( 'https://codex.wordpress.org/First_Steps_With_WordPress' ) ); ?></li>