Add Icons To Custom Taxonomies


Dynamically adding icons to categories, tags and other taxonomy terms can be achieved by using these plugins:

WP Term Icons

and

Wp Term Meta

1
2
3
4
5
6
7
8
9
10
11
12
<?php
 
// get current taxonomy term id on wordpress
$term_id = get_queried_object()->term_id;
 
// get the icon for the current term_id (found above)
$iconpic = get_term_meta( $term_id, ‘icon’, true );
 
// show the icon on the page
echo ‘<div class=”dashicons ‘ .$iconpic.'”></div>’;
 
?>

Leave a Reply

Your email address will not be published. Required fields are marked *