0

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?

4

1 回答 1

1

关于 the_terms 函数的文档-

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

看起来您提供的图像作为之前的参数,所以我只打印一次。尝试将图像放入两次,以便为 before 和 separation 参数打印它。

<?php the_terms( $post->ID, 'case_tags', '<img src="theimage" />', '<img src="theimage" />','<br /> '); ?></div><!--end .case-tags -->
于 2013-11-05T12:33:11.993 回答