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.

I need to print a specific term with its id. I get that for categories with this code:

<a href="<?php echo get_category_link(1); ?>" title="<?php echo get_cat_name(1);?>"><?php echo get_cat_name(1);?></a>

… where 1 is the id I have to print. Is there something like the following?

<?php echo get_term_link(1); ?>

or

<?php echo get_term_name(1); ?>
share|improve this question

1 Answer 1

up vote 1 down vote accepted

Use get_term() to get the name, slug, or description:

$term = get_term( 1, 'taxonomy_slug' );
// Name
echo $term->name;

// Link
echo get_term_link(1, 'taxonomy_slug'); 
// OR
echo get_term_link( $term ); 
share|improve this answer
    
thank you very much!!! it's just what I wanted!! –  federica Oct 31 '12 at 17:21
    
You're welcome. Please mark this question as being answered, so it goes off the list of unanswered questions. :) –  Eric Holmes Oct 31 '12 at 17:46
    
I'm sorry! I am beginner and especially my English :P:P i've marked it rigth? –  federica Oct 31 '12 at 17:54
    
Beside my answer there should be a checkmark ✓ <- Click it! :D –  Eric Holmes Oct 31 '12 at 17:57
    
ok! i did it :) –  federica Oct 31 '12 at 18:03

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.