SHARE
TWEET

Count Post in Tag

pustakakoran Apr 20th, 2017 (edited) 62 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Show in page tag:
  2.  
  3. <?php
  4. echo $wp_query->found_posts;
  5. ?>
  6.  
  7. ======================
  8.  
  9. Show dimana saja dengan input spesifik tag (mis: tag merdeka)
  10.  
  11. <?php
  12. $taxonomy = "post_tag"; // can be category, post_tag, or custom taxonomy name
  13.  
  14. // Using Term Slug
  15. $term_slug = 'merdeka';
  16. $term = get_term_by('slug', $term_slug, $taxonomy);
  17.  
  18. // Fetch the count
  19. echo $term->count;
  20. ?>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top