treehouse : what would you like to learn today?
Web Design Web Development iOS Development

Bring in ONE (random) term from a custom taxonomy field

  • What I'm trying to do is this:

    6 random people selected from a custom post type. Below those people (Where it currently says Municipal Law) I need to display one of the potentially many practice-areas (stored in a custom taxonomy) to which they belong. Oh and I'll need to put that into the class that wraps the words as well, but I'm hoping doing the first will make the second obvious.

    <?php $posts = get_posts('post_type=lawyer_profile&orderby=rand&numberposts=6'); foreach($posts as $post) { ?>
      <div class="photo-block">
    <?php if (class_exists('MultiPostThumbnails')) : MultiPostThumbnails::the_post_thumbnail(get_post_type(), 'secondary-image'); endif; ?>
      <h5 class="lawyer-name"><a href="<?php the_permalink(); ?>">
      <?php the_title(); ?></a></h5><div class="bar"></div>
      <h4 class="practice-name municipal"><span>Municipal Liability Law</span></h4>
                               </div>      
      <?php } ?>
    

    Grateful for any advice/thoughts.