Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!

WP Category Icons -- include/exclude

By: aendrew on Jul 9th, 2011  |  syntax: PHP  |  size: 0.55 KB  |  views: 85  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. add_shortcode('caticons_listing','bm_caticons_listing');
  2. function bm_caticons_listing($atts) {
  3. extract( shortcode_atts( array(
  4. 'include' => '',
  5. 'exclude' =>'',
  6. ), $atts ) );
  7. $listing_code = '';
  8. if ($atts['include']) $include = "&include=".$atts['include'];
  9. if ($atts['exclude']) $include = "&exclude=".$atts['exclude'];
  10. foreach(get_categories("orderby=name&order=ASC&hide_empty=0".$include.$exclude) as $category) {
  11. $listing_code .= $category->cat_name.' '.get_cat_icon("echo=false&cat=".$category->cat_ID);
  12. }
  13. $listing_code .= "";
  14. return $listing_code;
  15. }