<!--Ttags_as_images_food_in_this_recipes-->
<div class="food-in-rec">
<h5>Food in this recipe:</h5>
<?php
$output = '';
$posttags = get_the_tags();
if ($posttags) {
$img_path = get_bloginfo('stylesheet_directory');
foreach($posttags as $tag) {
$image = 'tag_icon_food_' . $tag->slug . '.png';
$link = get_tag_link( $tag->term_id);
$output .= $separator . '<a href="' . $link . '" class="img-tags">';
$output .= '</a>';
$separator =''; // this adds a space between the icons; you can change it
if(file_exists(STYLESHEETPATH.'/img/'.$image)) {
$output .= $separator . '<a href="' . $link . '" class="img-TAGS"> ';
$output .= '<img src="' . $img_path.'/img/'.$image . '" alt="tag ' . $tag->name .' icon" title="' . $tag->name .' " class="imagesTag"} />'. $tag->name .'';
$output .= '</a>';
} else {
$output .= '';
}
}
echo $output;
}
?>
</div>
<!--Ttags_as_images_food_in_this_recipes_END-->
tag_icon_food_tagname from wp - add images of tag on ftp
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.