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