If you are using the Widget Logic plugin, then you can use code like this:
is_single(1742) && ($meta = get_post_meta(1742,'pic_field',true)) && preg_match('/^http:\/\/.*jpg/',$meta)
Replace the 1742 with the ID of the post you want to match.
Then use the img tag in the widget to display the proper image.
Thanks vtxyzzy, the thing is I dont want to target a post.
I want the code in the widget, to detect if that particular post being viewed, has this custom field, and if yes, to displays its specific value
Well, the logic is similar. I have not tested this, but it should be close:
global $post;
is_single() &&
($meta = get_post_meta($post->ID,'pic_field',true) ) &&
preg_match('/^http:\/\/.*jpg/',$meta) ) {
echo "<img src='$meta' alt='Image for post $post->ID' />";
}
cool, not knowing much id say this is likely what im looking for, itll be a bit before i can test it myself.
THank you