Php code for show image if custom field image is not unavailable (wordpress)

[php]<?php echo "ID, 'thumbnail', true) ?>" width="50px" />”
if ( empty( $thumbnail ) && !empty( $the_post_thumbnail ) )
$thumbnail = “http://site.com/image.jpg
?>[/php]

If get_post_meta($post->ID, ‘thumbnail’, true) returns false, with [php]return false;[/php]
You could do,
[php]<?php
if (get_post_meta($post->ID, ‘thumbnail’, true)) {
echo “”;
}else{
echo ‘’;
}
?>[/php]

All depends on your setup, because I’m guessing $thumbnail and $the_post_thumbnail get processed inside the function?

Sponsor our Newsletter | Privacy Policy | Terms of Service