• Resolved sierrausa

    (@sierrausa)


    Unfortunately the PHP function is not working for me. Below is my code. What do I do wrong?

      <?php
      $taxonomy = ‘categories’;
      $queried_term = get_query_var($taxonomy);
      $terms = get_terms($taxonomy, ‘slug=’.$queried_term);
      if ($terms) {
      foreach($terms as $term) {
      ?>
      <li class=”cat-<?php echo $term->term_id ?>”>
      <?php tax_icons_output_term_icon( $term_id, $class ); ?>
      <?php echo $term->name .’ (‘. $term->count . ‘)’ ?>
      <?php

      }
      }
      ?>

    https://www.ads-software.com/plugins/taxonomy-icons/

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

    (@mcguive7)

    Well, for one, this line appears incorrect to me:

    $taxonomy = 'categories';

    When querying a taxonomy, you typically need to use the single term slug, which would look like this:

    $taxonomy = 'category';

    Also, this line probably won’t work either:

    <?php tax_icons_output_term_icon( $term_id, $class ); ?>

    You likely need to change that to:

    <?php tax_icons_output_term_icon( $term->term_id, $class ); ?>

    May be other errors too, but try addressing those first.

    Plugin Author Mickey Kay

    (@mcguive7)

    One other thing to note is that tax_icons_output_term_icon() needs to be used in conjunction with echo as it just returns the output. I’ll update the readme to reflect this.

    Plugin Author Mickey Kay

    (@mcguive7)

    Marking this as resolved because I haven’t heard back.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘icon is not showing up’ is closed to new replies.