문제

I have made custom posts with custom taxonomies. I am now trying to display an image in front of every custom tag.

With the code below I can only se an image in front of the first tag. I'd like the image to show before every tag.

<?php the_terms( $post->ID, 'case_tags', '<img src="theimage" />','<br /> '); ?></div><!--end .case-tags -->

I this possible?

도움이 되었습니까?

해결책

Documentation on the_terms function-

<?php the_terms( $id, $taxonomy, $before, $sep, $after ); ?> 

Looks like your providing the image as the before parameter, so i'ts only being printed once. Try putting the image in twice, so it gets printed for both the before and the seperation parameters.

<?php the_terms( $post->ID, 'case_tags', '<img src="theimage" />', '<img src="theimage" />','<br /> '); ?></div><!--end .case-tags -->
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top