Frage

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?

War es hilfreich?

Lösung

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 -->
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top