• Resolved Missketer

    (@missketer)


    I would like to show the taxonomy icon in place of the taxonomy name. Right now I have this code to show the name and it works well

    • <?php
      $recipe_method = get_the_terms( get_the_ID(), ‘recipe-method’ );
      if( !empty( $recipe_method ) ){
      $recipe_method = array_shift( $recipe_method );
      }
      ?>
      <?php _e( ‘Method:’, ‘recipe’ ) ?>
      <span class=”value”>
      $recipe_method->slug ), $permalink ) ) ?>”><?php echo $recipe_method->name;?>
      </span>
    • I have tried to use the output on the description page but it does not work. I want it to dynamically show the icon associated with the taxonomy in each post, I hope you understand what I mean and can direct me in the right direction. I will appreciate any help thanks

      https://ww.wp.xz.cn/plugins/taxonomy-icons/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Mickey Kay

    (@mcguive7)

    Hi there,

    Okay, so you’re part way there, but you need to use the included function:

    tax_icons_output_term_icon( $term_id, $class );

    So once you’ve gotten first term with get_the_terms(), you need to pass the term’s ID to the above listed function, like so:

    tax_icons_output_term_icon( $recipe_method->term_id );

    That should output the icon!

    Plugin Author Mickey Kay

    (@mcguive7)

    Wow, I think you need to wrap your first comment in a <code></code> block so that it doesn’t break this page 🙂

    Thread Starter Missketer

    (@missketer)

    Thanks. I see that too but cant seem to find the edit button for the previous comment. My apologies

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Output taxonomy icon’ is closed to new replies.