Display text if certain custom field text exists?
-
I know how to display a custom field if it simply exists:
<?php $key = 'my-custom-field'; $themeta = get_post_meta($post->ID, $key, TRUE); if($themeta != '') { echo 'Display this text if the custom field has been filled in'; } ?>
But is there any way to display some different text if that field has been filled in with certain text i.e. If the word Apple is inserted into the custom field I would like Fruit to be displayed on the web page and NOT the word Apple.
I’m sure there must be a way to question whether a certain word exists in the custom field but I really don’t know how!
Any help would be greatly appreciated.
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Display text if certain custom field text exists?’ is closed to new replies.