Support » Fixing WordPress » Tag cloud with icons

  • Resolved webkeon.sushil


    Hello Everyone,
    Is there any way that we can assign the images icons to the TAG cloud widget.
    Like on Front end in Tag cloud widget we can show the image and tag name.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Not without recoding the tag cloud widget and tag widget.

    The tag widget in the editor would need to be able to associate an icon with a tag term and store that association as a term/file pair.

    The tag cloud widget would need to generate HTML for that term/file pair as a img tag wrapped around the anchor tag for the term.

    I used this Plugin -
    and by using below function i am now able to show the TAG with icons in my sidebar.

    $tags = get_tags();
    $html = '<div class="post_tags">';
    foreach ( $tags as $tag ) {
    	$meta_image = get_wp_term_image($tag->term_id );
    	$tag_link = get_tag_link( $tag->term_id );
    	$html .= "<li><a href='{$tag_link}' title='{$tag->name} Tag' class='{$tag->slug}'><img src='$meta_image' /> ";
    	$html .= "{$tag->name}</a><li>";
    $html .= '</div>';
    echo $html;?>

    Now i am trying to show this icon along with my listing page.
    So like below i had done but i want the tag ID dynamically

    $tags_list = get_the_tag_list( '', _x( ', ', 'Used between list items, there is a space after the comma.', 'twentyfifteen' ) );
    		if ( $tags_list ) {
    			$meta_image = get_wp_term_image(69);
    			printf( '<span class="tags-links"><span class="screen-reader-text" >%1$s</span><img src="'.$meta_image.'" />%2$s</span>',
    				_x( 'TAG', 'Used before tag names.', 'twentyfifteen' ),

    $meta_image = get_wp_term_image(69);
    Above 69 is static value how can get it dynamically
    This is part entry_meta function.

    i have change the way instead of entry_meta function use the below for showing the TAG

    $posttags = get_the_tags();
    if ($posttags) {
    foreach($posttags as $tag) {
    $meta_image = get_wp_term_image($tag->term_id);
    echo ‘TAG <img src=’.$meta_image.’ />’;

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Tag cloud with icons’ is closed to new replies.