I've created a custom post type called 'work' for a portfolio section on the site I am working on at the moment. I have also registered the taxonomy 'workcategories' so that I can assign different pieces of work to different categories like:

Artists, Charities, Independents, International, Well Known

Which I have created via the WordPress Admin.

My problem is that I can't figure out how to display these terms as a list of links within my sidebar under the title 'Categories' and for these terms to link to archive pages displaying the work assigned to each.

At the moment I have this code in my index-work.php page to display ALL WORK:

<?php query_posts('post_type=work&posts_per_page=4'); ?>

And I think I need to adapt this for my taxonomy pages. I've created a taxonomy-workcategories.php page for this purpose, but not sure if I actually have to create a separate page for each term listed above? Or can I use the taxonomy-workcategories.php all.

Any help much appreciated as I'm a bit lost. It's my first time working with taxonomies and I'm finding it all a bit confusing.

1 Answer 1


You shouldn't have to create a separate template file for each taxonomy.

You can use the wp_list_categories function to create a list in your sidebar, the Codex article has a code example, but something like this should work:

    <?php wp_list_categories('taxonomy=workcategories'); ?>
  • I used the code from the Codex article and this works perfectly for listing my categories. thanks.
    – Evie Milo
    Commented Oct 19, 2011 at 10:33
  • I also created a seperate template file for each taxonomy as it wouldn't work otherwise
    – Evie Milo
    Commented Oct 19, 2011 at 10:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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