Ok so at the moment I have a page which displays a list of categories within my Taxonomy (event-themes), here's the code:

<div id="themeSearch">
    <h1 class="mainSectionHeader">By Theme</h1>
    <ul id="themeSelector" class="jcarousel jcarousel-skin-tango">
        //list custom portfolio categories
        $taxonomy = 'event-themes';  // define portfolio categories from taxonomies in functions.php
        $tax_terms = get_terms($taxonomy);

        foreach ($tax_terms as $tax_term) {
        echo '<li class="themeItem"><p><span>' . $tax_term->name.'</span></p><a href="index.php?<?php get_the_category( $id ) ?>" rel="' . $tax_term->slug . '"><span>Go</span></a>';

First of all, I am aware that the echo'd link does not work, and that is what I need help with.

I'm trying to not only display all of the categories, but I also want each of them to link to a page displaying the posts within that particular category.

I think I'm almost there with this code, as what I am trying to do is insert the category ID within the href so that for each listed category it directs to the correct page.

Many thanks

1 Answer 1


This should work:

foreach ($tax_terms as $tax_term) {
    echo '<a href="'.get_term_link($tax_term).'">'.$tax_term->name.'</a>';

Simplified a bit from your version for readability.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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