I want to add a specific image to my posts, depending on which category the post is in. I've added this to single.php:
<?php if (in_category('stamppotje')) { ?>
<img src="http://kokenvoormijndochter.nl/wp-content/themes/twentyten-koken/images/s.png">
<?php } elseif (in_category('smoothie')) { ?>
<img src="http://kokenvoormijndochter.nl/wp-content/themes/twentyten-koken/images/m.png">
<?php } else { ?>
<img src="http://kokenvoormijndochter.nl/wp-content/themes/twentyten-koken/images/v.png">
<?php } ?>
That works fine: a little image is displayed below the title, as you can see here for example (site is in dutch but that shouldn't matter ;-)
Now I want to do the same on the blog's main page, adding the same little image below the titles of posts displayed, depending on their category. I've tried adding the same code to loop.php, but there it doesn't work. I can't understand why not. Help would be much appreciated!



News