I've got this code here: `<?php
$url = get_bloginfo('stylesheet_directory');
$url = $url.'/images/';
$taglink = get_tag_link($tag_id);
$posttags = get_the_tags();
if ($posttags) {
foreach($posttags as $tag) {
echo '<img src="'.$url. $tag->term_id . '.jpg"
alt="' . $tag->name . '" />';
}
}
?>`
which creates images instead of tags and might output something like this:
<img src="http://www.mysite.com/wp-content/themes/mytheme/images/36.jpg"
alt="cat" /><img src="http://www.mysite.com/wp-content/themes/mytheme/images/37.jpg"
alt="dog" />
All you have to do is make the image of a cat, say, match the ID of the tag Cat by naming it 36.jpg
My question - how can I get these images to also be links? My best and rather feeble effort was this, which just gave the same link to every image:
<?php
$url = get_bloginfo('stylesheet_directory');
$url = $url.'/images/';
$taglink = get_tag_link($tag_id);
$posttags = get_the_tags();
if ($posttags) {
foreach($posttags as $tag) {
echo '<a href="'.$taglink.'"> <img src="'.$url. $tag->term_id . '.jpg"
alt="' . $tag->name . '" /></a>';
}
}
?>