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

<?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 *