Posted By

Wiederkehr on 05/05/08


Tagged

wordpress tags


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

Bluewall
Caimin


Wordpress tag list with CSS classes


 / Published in: PHP
 

URL: http://www.positivespaceblog.com/archives/how-to-create-a-tag-grid-and-evolve-past-the-cloud/

  1. <ul id="tag_grid">
  2. <?php
  3. $tags = get_tags(array('orderby' => 'count', 'order' => 'DESC', 'number' => 25));
  4.  
  5. foreach ($tags as $tag) {
  6. if ($tag->count < 5) {
  7. echo('<li class="tagclass1">');
  8. } else if ($tag->count < 15) {
  9. echo('<li class="tagclass2">');
  10. } else if ($tag->count < 25) {
  11. echo('<li class="tagclass3">');
  12. } else {
  13. echo('<li class="tagclass4">');
  14. }
  15.  
  16. echo('<a href="' . get_tag_link($tag->term_id) . '" rel="tag">' . $tag->name . "</a></li>\n");
  17. }
  18. ?>
  19. </ul>

Report this snippet  

You need to login to post a comment.