I need a conditional statement to sit inside my WORDPRESS LOOP that reads as follows – this is just an example of what I need, I do not have enough knowledge of PHP to structure this properly:
It should read:
if the_author_meta('client_id') = 'custom-value-1' then display the following code
<div><img src="http://www.mywebsite.com/<?php echo get_post_meta($post->ID, 'img-id', true) ?>"/></div>
else display nothing
The client_id is stored in the_author_meta, so the function needs to check the value of client_id in the_author_meta and check if it matches the value I enter e.g. “custom-value-1”. If it matches, then it would display the div code, and if not, it would display nothing.
Can someone show me how to structure this into a proper PHP string please? I am still learning PHP so this will be a big help in my understanding : – )
Zach
This should do it.
See here for comparison operators
Operators
Structures