Ticket #5820: wp-admin-index.php.diff

File wp-admin-index.php.diff, 2.6 kB (added by josephscott, 10 months ago)
  • index.php

    old new  
    3737<h3 class="reallynow"><?php _e('Right Now'); ?> <a href="post-new.php" class="rbutton"><?php _e('Write a New Post'); ?></a> <a href="page-new.php" class="rbutton"><?php _e('Write a New Page'); ?></a></h3> 
    3838 
    3939<?php 
    40 $num_posts = wp_count_posts('post', 'publish'); 
     40$num_posts = wp_count_posts( 'post' ); 
     41$num_pages = wp_count_posts( 'page' ); 
    4142 
    42 $num_pages = wp_count_posts('page', 'publish'); 
    43  
    44 $num_drafts = wp_count_posts('post', 'draft'); 
    45  
    46 $num_future = wp_count_posts('post', 'future'); 
    47  
    48 $num_comments = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->comments WHERE comment_approved = '1'"); 
    49  
    5043$num_cats  = wp_count_terms('category'); 
    5144 
    5245$num_tags = wp_count_terms('post_tag'); 
    5346 
    5447$post_type_texts = array(); 
    5548 
    56 if ( $num_posts ) { 
    57         $post_type_texts[] = '<a href="edit.php">'.sprintf( __ngettext( '%s post', '%s posts', $num_posts ), number_format_i18n( $num_posts ) ).'</a>'; 
     49if ( $num_posts['publish'] ) { 
     50        $post_type_texts[] = '<a href="edit.php">'.sprintf( __ngettext( '%s post', '%s posts', $num_posts['publish'] ), number_format_i18n( $num_posts['publish'] ) ).'</a>'; 
    5851} 
    59 if ( $num_pages ) { 
    60         $post_type_texts[] = '<a href="edit-pages.php">'.sprintf( __ngettext( '%s page', '%s pages', $num_pages ), number_format_i18n( $num_pages ) ).'</a>'; 
     52if ( $num_pages['publish'] ) { 
     53        $post_type_texts[] = '<a href="edit-pages.php">'.sprintf( __ngettext( '%s page', '%s pages', $num_pages['publish'] ), number_format_i18n( $num_pages['publish'] ) ).'</a>'; 
    6154} 
    62 if ( $num_drafts ) { 
    63         $post_type_texts[] = '<a href="edit.php?post_status=draft">'.sprintf( __ngettext( '%s draft', '%s drafts', $num_drafts ), number_format_i18n( $num_drafts ) ).'</a>'; 
     55if ( $num_posts['draft'] ) { 
     56        $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>'; 
    6457} 
    65 if ( $num_future ) { 
    66         $post_type_texts[] = '<a href="edit.php?post_status=future">'.sprintf( __ngettext( '%s scheduled post', '%s scheduled posts', $num_future ), number_format_i18n( $num_future ) ).'</a>'; 
     58if ( $num_posts['future'] ) { 
     59        $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>'; 
    6760} 
    6861 
    6962$cats_text = '<a href="categories.php">'.sprintf( __ngettext( '%s category', '%s categories', $num_cats ), number_format_i18n( $num_cats ) ).'</a>';