Advertisement
pusatdata

WP-php: code for post count published

Aug 27th, 2016
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.28 KB | None | 0 0
  1. Cara 1:
  2. <?php echo wp_count_posts()->publish; ?>
  3.  
  4. Cara 2:
  5. <?php
  6. $count_posts = wp_count_posts();
  7. echo $count_posts->publish;
  8. ?>
  9.  
  10. Cara 3:
  11. <?php $numpost = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->posts WHERE post_status = 'publish' AND post_type = 'post'"); echo $numpost; ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement