multiple icons in loop
-
I’m trying to loop inside my post’s tag but this code return this string “1 · 1 · 1 · 1 · 1 · 1”
How can i loop inside post’s tag and show the icons??? thanks in advance
<?php $postid = get_the_ID(); $terms = get_the_terms( $postid, 'post_tag' ); if ( ! empty( $terms ) && ! is_wp_error( $terms ) ) { $count = count( $terms ); $i = 0; $term_list = ''; foreach ( $terms as $term ) { $i++; $icon = get_the_icon(array('size=medium&class=icone'), 'post_tag' , true); $term_list .= print ( $icon ); if ( $count != $i ) { $term_list .= ' · '; } else { $term_list .= ''; } } echo $term_list; }; ?>
- The topic ‘multiple icons in loop’ is closed to new replies.