Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $taxonomy = "category"; // can be category, post_tag, or custom taxonomy name
- // Use any one of the three methods below
- // Using Term ID
- $term_id = 1;
- $term = get_term_by('id', $term_id, $taxonomy);
- // Using Term Name
- $term_name = 'A Category';
- $term = get_term_by('name', $term_name, $taxonomy);
- // Using Term Slug
- $term_slug = 'a-category';
- $term = get_term_by('slug', $term_slug, $taxonomy);
- // Fetch the count
- echo $term->count;
- ?>
- MODIFIKASI:
- Jumlah post dari sebuah tags, dimana tags otomatis dari sebuah tanggal.
- <?php
- $taxonomy = "post_tag"; // can be category, post_tag, or custom taxonomy name
- // Using Term Name
- $term_name = get_the_date('Ymd');
- $term = get_term_by('name', $term_name, $taxonomy);
- // Fetch the count
- echo $term->count;
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement