Advertisement
pusatdata

Jumlah Post, Kategori, Komen WP

Apr 9th, 2016
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1. <?php
  2. $numposts = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->posts WHERE post_status = 'publish'");
  3. if (0 < $numposts) $numposts = number_format($numposts);
  4.  
  5. $numcomms = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->comments WHERE comment_approved = '1'");
  6. if (0 < $numcomms) $numcomms = number_format($numcomms);
  7.  
  8. $numcats = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->categories");
  9. if (0 < $numcats) $numcats = number_format($numcats);
  10. ?>
  11. <p><?php printf(__('There are currently %1$s <a href="%2$s" title="Posts">posts</a> and %3$s <a href="%4$s" title="Comments">comments</a>, contained within %5$s <a href="%6$s" title="categories">categories</a>.'), $numposts, 'edit.php', $numcomms, 'edit-comments.php', $numcats, 'categories.php'); ?></p>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement