Advertisement
jonahcoyote

New tribe_meta_event_cats

Dec 5th, 2011
247
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.03 KB | None | 0 0
  1. /**
  2.      * Event Categories (Display)
  3.      *
  4.      * Display the event categories
  5.      *
  6.      * @param string $label
  7.      * @param string $separator
  8.      * @uses the_terms()
  9.      * @since 2.0
  10.      */
  11.     function tribe_meta_event_cats( $label=null, $separator=', ')  {
  12.         if( !$label ) { $label = __('Category:', 'tribe-events-calendar'); }
  13.  
  14.         $tribe_ecp = TribeEvents::instance();
  15.         //the_terms( get_the_ID(), $tribe_ecp->get_event_taxonomy(), '<dt>'.$label.'</dt><dd>', $separator, '</dd>' );
  16.        
  17.         $args = array( 'orderby' => 'slug' );
  18.  
  19.         $terms = get_terms($tribe_ecp->get_event_taxonomy(), $args);
  20.        
  21.         $count = count($terms); $i=0;
  22.         if ($count > 0) {
  23.             echo '<dt>' . $label . '</dt>';
  24.             echo '<dd>';
  25.             foreach ($terms as $term) {
  26.                 $i++;
  27.                 $term_list .= '<a href="/calendar/category/' . $term->slug . '" title="' . sprintf(__('View all post filed under %s', 'my_localization_domain'), $term->name) . '" class="' . $term->slug . '">' . $term->name . '</a>, ';
  28.             }
  29.             echo $term_list;
  30.             echo '</dd>';
  31.         }
  32.        
  33.     }
  34.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement