Wordpress Categories Nav


/ Published in: PHP
Save to your folder(s)

reference:
http://codex.wordpress.org/Template_Tags/wp_list_categories


Copy this code and paste it in your HTML
  1. <div class="nav">
  2. <ul>
  3. <?php wp_list_categories('title_li='); ?>
  4. </ul>
  5. </div>
  6.  
  7. <div class="nav">
  8. <ul>
  9. <?php
  10. $variable = wp_list_categories('echo=0&orderby=name&show_count=1&child_of=1&feed=RSS&title_li=');
  11. $variable = str_replace(array(') ('), '</span> <span class="counts">', $variable);
  12. $variable = str_replace(array('('), '<span>', $variable);
  13. $variable = str_replace(array(')'), '</span>', $variable);
  14. echo $variable;
  15. ?>
  16. </ul>
  17. </div>
  18.  
  19. <div class="nav">
  20. <ul>
  21. <?php
  22. $variable = wp_list_categories('echo=0&show_count=1&title_li=');
  23. $variable = str_replace(array('('), '<span class="counts">', $variable);
  24. $variable = str_replace(array(')'), '</span>', $variable);
  25. echo $variable;
  26. ?>
  27. </ul>
  28. </div>

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.