• I have a loop that queries a post type to extract the category name and set the class of a list item to that name plus adding a class of “all” as well.
    I want to change this so I can use a custom post type & taxinomy instead.
    The following code works on a standard post:

    <li class="<?php foreach((get_the_category()) as $category ) { echo $category->cat_name . ' ' . ' all'; } ?>">

    I’ve tried:

    <li class="<?php foreach(get_the_term_list( $post->ID, 'service', 'all')); ?>">

    but this breaks

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘get_the_term_list in a loop’ is closed to new replies.