WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to display my categories in tabs. All is good, except my "Upcoming Events", created with Event Organiser (awesome plugin at http://wordpress.org/extend/plugins/event-organiser/), are not being treated like a normal category, so they don't appear. In essence, get_categories() is not returning the events category. How can I fix this display?

$args = array('type'=> 'post', 'order' => 'ASC', 'hide_empty' => 1 );
$categories = get_categories( $args );
foreach($categories as $category) {
    echo '<li><a href="#tabs-content-'.strtolower($category->term_id).'" title="' . sprintf( __( "View all posts in %s" ), $category->name ) . '" ' . '>' . $category->name.'</a></li>';
share|improve this question
up vote 2 down vote accepted

Event categories are terms in a custom taxonomy, 'event-category', so you should use get_terms instead:

//Args for which terms to retrieve
$args = array('type'=> 'post', 'order' => 'ASC', 'hide_empty' => 1 );

//Array of taxonomies from which to collect the terms
$taxonomies = array('event-category');

//Get the terms
$terms = get_terms( $taxonomies, $args);

//loop through the terms and display
foreach($terms as $term) {
    echo '<li><a href="#tabs-content-'.strtolower($term->term_id).'" title="' . sprintf( __( "View all posts in %s" ), $term->name ) . '" ' . '>' . $term->name.'</a></li>';

If you want to get terms for both the 'category' and 'event-category' taxonomy then you can add 'category' to the $taxonomies array.

share|improve this answer
Works like a charm! Stephen you rock my world. – Zade Jul 17 '12 at 20:14

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.