Make WordPress Core


Ignore:
Timestamp:
02/05/2008 07:08:14 PM (17 years ago)
Author:
ryan
Message:

Add wp_count_posts().

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/index.php

    r6705 r6730  
    3838
    3939<?php
    40 $num_posts = $wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->posts WHERE post_type = 'post' AND post_status = 'publish'" );
     40$num_posts = wp_count_posts('post', 'publish');
    4141
    42 $num_pages = $wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->posts WHERE post_type = 'page' AND post_status = 'publish'" );
     42$num_pages = wp_count_posts('page', 'publish');
    4343
    44 $num_drafts = $wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->posts WHERE post_type = 'post' AND post_status = 'draft'" );
     44$num_drafts = wp_count_posts('post', 'draft');
    4545
    46 $num_future = $wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->posts WHERE post_type = 'post' AND post_status = 'future'" );
     46$num_future = wp_count_posts('post', 'future');
    4747
    4848$num_comments = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->comments WHERE comment_approved = '1'");
Note: See TracChangeset for help on using the changeset viewer.