Display icon of main category
-
Hi,
I have main categories wich have assigned icons;
In subcategories I have no assigned icons;
I want to display in post view subcategory with main category icon;
This is code I’m using:
{ if ($format == 'video') { $tax = c5_get_post_tax(get_the_ID()); $terms = wp_get_post_terms(get_the_ID(), $tax); if (count($terms) != 0) { foreach ($terms as $term) { $tax = c5_get_post_tax(get_the_ID()); $terms = wp_get_post_terms(get_the_ID(), $tax); $icon .= c5_get_category_icon( $tax . '-' . $term->term_id); if ($icon) { $icon = c5_get_category_icon( $tax . '-' . $term->term_id); } else { $icon = 'fa fa-folder'; } $data .= '<span class="list-icon ' . $icon . ' "></span>'; } }
Can someone help?
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Display icon of main category’ is closed to new replies.