3 require_once('admin.php');
5 require_once(ABSPATH . 'wp-admin/includes/dashboard.php');
11 <script type="text/javascript">
14 dashboard_incoming_links: 'incominglinks',
15 dashboard_primary: 'devnews',
16 dashboard_secondary: 'planetnews',
17 dashboard_plugins: 'plugins'
19 $.each( ajaxWidgets, function(i,a) {
20 var e = jQuery('#' + i + ' div.dashboard-widget-content').not('.dashboard-widget-control').find('.widget-loading');
21 if ( e.size() ) { e.parent().load('index-extra.php?jax=' + a); }
27 add_action( 'admin_head', 'index_js' );
29 function index_css() {
30 wp_admin_css( 'css/dashboard' );
32 add_action( 'admin_head', 'index_css' );
34 wp_enqueue_script( 'jquery' );
36 $title = __('Dashboard');
37 $parent_file = 'index.php';
38 require_once('admin-header.php');
40 $today = current_time('mysql', 1);
45 <h2><?php _e('Dashboard'); ?></h2>
48 <h3 class="reallynow">
49 <span><?php _e('Right Now'); ?></span>
51 <?php if ( $can_edit_posts = current_user_can( 'edit_posts' ) ) : ?>
52 <a href="post-new.php" class="rbutton"><strong><?php _e('Write a New Post'); ?></strong></a>
53 <?php endif; if ( $can_edit_pages = current_user_can( 'edit_pages' ) ) : ?>
54 <a href="page-new.php" class="rbutton"><?php _e('Write a New Page'); ?></a>
60 $num_posts = wp_count_posts( 'post' );
61 $num_pages = wp_count_posts( 'page' );
63 $num_cats = wp_count_terms('category');
65 $num_tags = wp_count_terms('post_tag');
67 $post_type_texts = array();
69 if ( !empty($num_posts->publish) ) { // with feeds, anyone can tell how many posts there are. Just unlink if !current_user_can
70 $post_text = sprintf( __ngettext( '%s post', '%s posts', $num_posts->publish ), number_format_i18n( $num_posts->publish ) );
71 $post_type_texts[] = $can_edit_posts ? "<a href='edit.php'>$post_text</a>" : $post_text;
73 if ( $can_edit_pages && !empty($num_pages->publish) ) { // how many pages is not exposed in feeds. Don't show if !current_user_can
74 $post_type_texts[] = '<a href="edit-pages.php">'.sprintf( __ngettext( '%s page', '%s pages', $num_pages->publish ), number_format_i18n( $num_pages->publish ) ).'</a>';
76 if ( $can_edit_posts && !empty($num_posts->draft) ) {
77 $post_type_texts[] = '<a href="edit.php?post_status=draft">'.sprintf( __ngettext( '%s draft', '%s drafts', $num_posts->draft ), number_format_i18n( $num_posts->draft ) ).'</a>';
79 if ( $can_edit_posts && !empty($num_posts->future) ) {
80 $post_type_texts[] = '<a href="edit.php?post_status=future">'.sprintf( __ngettext( '%s scheduled post', '%s scheduled posts', $num_posts->future ), number_format_i18n( $num_posts->future ) ).'</a>';
83 if ( current_user_can('publish_posts') && !empty($num_posts->pending) ) {
84 $pending_text = sprintf( __ngettext( 'There is <a href="%1$s">%2$s post</a> pending your review.', 'There are <a href="%1$s">%2$s posts</a> pending your review.', $num_posts->pending ), 'edit.php?post_status=pending', number_format_i18n( $num_posts->pending ) );
89 $cats_text = sprintf( __ngettext( '%s category', '%s categories', $num_cats ), number_format_i18n( $num_cats ) );
90 $tags_text = sprintf( __ngettext( '%s tag', '%s tags', $num_tags ), number_format_i18n( $num_tags ) );
91 if ( current_user_can( 'manage_categories' ) ) {
92 $cats_text = "<a href='categories.php'>$cats_text</a>";
93 $tags_text = "<a href='edit-tags.php'>$tags_text</a>";
96 $post_type_text = implode(', ', $post_type_texts);
98 // There is always a category
99 $sentence = sprintf( __( 'You have %1$s, contained within %2$s and %3$s. %4$s' ), $post_type_text, $cats_text, $tags_text, $pending_text );
100 $sentence = apply_filters( 'dashboard_count_sentence', $sentence, $post_type_text, $cats_text, $tags_text, $pending_text );
103 <p class="youhave"><?php echo $sentence; ?></p>
105 $ct = current_theme_info();
106 $sidebars_widgets = wp_get_sidebars_widgets();
107 $num_widgets = array_reduce( $sidebars_widgets, create_function( '$prev, $curr', 'return $prev+count($curr);' ) );
108 $widgets_text = sprintf( __ngettext( '%d widget', '%d widgets', $num_widgets ), $num_widgets );
109 if ( $can_switch_themes = current_user_can( 'switch_themes' ) )
110 $widgets_text = "<a href='widgets.php'>$widgets_text</a>";
113 <?php printf( __( 'You are using %1$s theme with %2$s.' ), $ct->title, $widgets_text ); ?>
114 <?php if ( $can_switch_themes ) : ?>
115 <a href="themes.php" class="rbutton"><?php _e('Change Theme'); ?></a>
117 <?php update_right_now_message(); ?>
120 <?php do_action( 'rightnow_end' ); ?>
121 <?php do_action( 'activity_box_end' ); ?>
122 </div><!-- rightnow -->
126 <div id="dashboard-widgets-wrap">
128 <?php wp_dashboard(); ?>
131 </div><!-- dashboard-widgets-wrap -->
135 <?php require('./admin-footer.php'); ?>