SHARE
TWEET

Daftar Tags dengan Jumlahh Post

pustakakoran Apr 20th, 2017 (edited) 71 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Paste di theme:
  2.  
  3. MODEL 1: TANPA BULLET
  4. <?php $terms = get_terms('post_tag',array('hide_empty'=>false));
  5. foreach($terms as $t) {
  6.   echo $t->name.' :: '.$t->count.'</br>';
  7. } ?>
  8.  
  9. Jika ingin ditambahkan link tagnya gunakan: get_tag_link
  10.  
  11. MODEL 2: ADA BULLET LIST
  12. <?php
  13.             $tags = get_tags( array('name__like' => "a", 'order' => 'ASC') );
  14.             foreach ( (array) $tags as $tag ) { ?>
  15.                 <li>                            
  16.                     <a href="<?php echo get_tag_link( $tag->term_id ) ?>">          
  17.                         <span class="name"><?php echo $tag->name ?></span>
  18.                         <span class="number"><?php echo $tag->count ?></span>
  19.                     </a>
  20.                 </li>
  21.             <?php } ?>
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