Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Almost all themes display categories (with its permalink) by default. I am looking for similar type of code to add in my theme. From where can I get it? To create custom taxonomies, I'm using More Taxonomies plugin.

share|improve this question
add comment

3 Answers

up vote 3 down vote accepted

The easiest way to list terms of custom taxonomy and display them would be to use

 <?php get_the_term_list( $id, $taxonomy, $before, $sep, $after ) ?> 

For example in the loop, my custom taxonomy is 'jobs' list as li

 <ul><?php get_the_term_list( $post->ID, 'jobs', '<li class="jobs_item">', '', '</li>' ) ?></ul>
share|improve this answer
1  
Missing quotes around the jobs_item li element and one on the end of the closing li mate.. ;) –  t31os Feb 23 '11 at 12:27
add comment

None of the code on this page worked, but the example from the wordpress site did:

<?php echo get_the_term_list( $post->ID, 'people', 'People: ', ', ', '' ); ?> 

I got it from http://codex.wordpress.org/Function_Reference/get_the_term_list

Hope it helps other lost souls who would like to display the current post taxonomies :)

share|improve this answer
add comment

Check this out. it worked for me. i have a taxonomy named 'stores', and i wanted to display 2 taxonmies from it.

<?php
    $taxonomy = 'stores';
    $args1=array(
        'include'=> array(12,30)
        );

    $terms = get_terms('stores',$args1 );
    echo '<ul>';


    foreach ($terms as $term) {
        //Always check if it's an error before continuing. get_term_link() can be finicky sometimes
        $term_link = get_term_link( $term, 'stores' );
        if( is_wp_error( $term_link ) )
            continue;
        //We successfully got a link. Print it out.


        echo '<li><a href="' . $term_link . '">' . $term->name . '</a></li>';
    }
    echo '</ul>';
    ?>
share|improve this answer
add comment

Your Answer

 
discard

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.