I am trying to solve a problem and need help :) First, I have a custom grid displaying terms and images from my custom taxonomy. This is the code I'm using currently:


$terms = get_terms( 'industrygroups' , 'hide_empty=false' );

echo '<div class="row">';

foreach ( $terms as $term ) {

    // The $term is an object, so we don't need to specify the $taxonomy.
    $term_link = get_term_link( $term );

    // If there was an error, continue to the next term.
    if ( is_wp_error( $term_link ) ) {

    // We successfully got a link. Print it out.
    echo '<div class="col-lg-3"><a href="' . esc_url( $term_link ) . '">' . $term->name . '</a></div>';

echo '</div>';


What I would like to accomplish now is to use a custom field from my taxonomy term (which has been added via ACF. The field is a dropdown, displaying different Levels 1-5.

I want each chosen level to output a different color border/background around the tax term shown in the grid - In the Front End

Now, I have been trying to follow this tutorial which addresses how to accomplish this with posts, however I'm struggling to transfer this train of thought to apply to taxonomy terms. I would love some advice. Thank you.

  • Maybe this plugin will help you: wordpress.org/plugins/mark-posts
    – Sven
    Commented Jul 19, 2014 at 17:32
  • 1
    Sven, while that is pretty cool, it's not quite what I need. I updated my post to specify this style change was needed to display in the front end.
    – streetfire
    Commented Jul 19, 2014 at 20:08

1 Answer 1


You could use the slug of each term as class name (and do the styling via CSS)


echo '<div class="col-lg-3 ' . $term->slug . '">'; // $term->slug is the class name
echo '<a href="' . esc_url( $term_link ) . '">' . $term->name . '</a>';
echo '</div>';


If you want to use dynamic terms and colors I recommend the Mark Posts Plugin; it is possible to manage the terms/colors in the admin area and you can also display the terms/colors in the front end as you can see here:


 * Display terms & colors of a post

$post_markers = wp_get_post_terms( $post->ID, 'marker' );

echo '<ul>';

foreach ( $post_markers as $post_marker ) :
  echo '<li>';
  echo __('Marker', 'textdomain') . ': ' . $post_marker->name  . '<br />';
  echo __('Color', 'textdomain') . ': ' . $post_marker->description . '<br />';
  echo '</li>';

echo '</ul>';

  • 1
    Thank you Sven, I will play with those ideas and get back to you. :)
    – streetfire
    Commented Jul 20, 2014 at 0:01
  • @streetfire Feel free to let me know if you need further help with this :)
    – Sven
    Commented Jul 20, 2014 at 21:08
  • Is there a way to use this with custom tax terms in the back end? (i.e. set color for parent terms, another for child terms etc)
    – streetfire
    Commented Aug 18, 2014 at 23:16
  • @streetfire So you want to assign terms to terms? You can combine multiple terms via tax_query within your custom query...
    – Sven
    Commented Aug 19, 2014 at 0:15
  • Please keep in mind to ask a new question and link to similar questions if you're facing another problem than above :)
    – Sven
    Commented Aug 19, 2014 at 0:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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