I have the following piece of code:
<?php echo get_custom_field('Services'); ?>
There are three possible string outputs for this: “food”, “drink”, “food & drink”.
I would like to replace these strings with small icons (e.g. a glass for “drink”).
Is there a simple way of doing this with PHP?
Thanks
You could map the values via an array:
Then perform your look-up when echoing the image:
You could use switch:
Not a direct answer, but I would add a class to the (containing…) element and use css to remove the text and show a background image:
php:
css: