Skip to content

Instantly share code, notes, and snippets.

@bmoredrew
Last active August 29, 2015 14:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bmoredrew/d43ebcaf7f01006ec8ec to your computer and use it in GitHub Desktop.
Save bmoredrew/d43ebcaf7f01006ec8ec to your computer and use it in GitHub Desktop.
<?php
$catargs = array(
'type' => 'tribe_events',
'orderby' => 'name',
'order' => 'ASC',
'hide_empty' => 1,
'hierarchical' => 1,
'number' => 5,
'taxonomy' => 'tribe_events_cat',
'pad_counts' => false
);
$eventcats = get_categories( $catargs );
foreach ($eventcats as $eventcat):
$catID = $eventcat->term_id;
echo $catID; //correct IDs show...
echo get_category_link('14'); // but empty output!
echo get_category_link('cooking-class'); //empty
echo get_category_link( $eventcat->term_id ); //also emtpy!
//var_dump on above just return 0!
?>
<a href=" <?php echo esc_url( get_category_link( $catID ) ); ?> ">
<img src="<?php echo get_template_directory_uri(); ?>/assets/img/category1.jpg" alt="illustration">
<span class="category-name">
<?php echo $eventcat->name; ?>
</span>
</a>
<?php
endforeach;
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment