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 have used the excellent tutorial of Justin Tadlock on Custom user taxonomies in WordPress to add a Blog custom taxonomy to both my Posts post_type as well as the user object_type.

In his tutorial Justin then outputs a list of users that share the same (profession) taxonomy.

I on the other hand would like to output the specific term of my Blog taxonomy on the author.php archive, together with some other user_meta-fields I already have added to the User Profile.

How would I be able to accomplish this? Ideally it not only outputs the taxonomy term, but also a link to the term archive.

share|improve this question
    
You want to output categories, for example, assigned to posts that your author has written? –  s_ha_dum Jul 18 '13 at 2:43
    
@s_ha_dum I have a custom taxonomy called "Blog" which is attached to the Post post_type and the User object_type according to the tutorial linked above. When on the author.php it usually shows the profile of the author and then lists the Posts written by that author, correct? Now in that profile I want to output the associated Blog (incl. link). I hope now it's more clear. –  Piet Jul 18 '13 at 3:35

1 Answer 1

up vote 1 down vote accepted

I found my own answer in the Codex.

In my use case scenario:

$blog_terms = wp_get_object_terms( $post->ID, 'blog' );
if ( ! empty( $blog_terms ) ) {
  if ( ! is_wp_error( $blog_terms ) ) {
    foreach( $blog_terms as $term ) {
      echo '<p>' . __( 'Associated Blog: ', 'wys' ) . '<a href="' . get_term_link( $term->slug, 'blog' ) . '">' . $term->name . '</a></p>'; 
    }
  }
}
share|improve this answer

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.