How can I display certain image in a post if that post contains a specific custom value.
For example, I have two posts, one has a custom field named top_post
and its value is true
. The other one doesn't have that value at all. I want the one with this value set to true
to have image displayed (an image that shows it's a top post) and the one without the value to show nothing.
I know that the function would be something like "if top_post value is 'true' then display img(url)" but I don't know how to write that function as I'm just a PHP beginner.
Any help appreciated.
EDIT: I tried finding the function code on various coding blogs but didn't succeed... Also, I have no function coding experiences and that's why I was asking for a function code.