wordpress check if custom field empty inside an echo statement

admin

Administrator
Staff member
Trying to edit a wordpress theme, where in a widget code echo statement i want to check if custom field empty show tag otherwise don't show it. Can any one help

At the moment its running
Code:
if($theI <= $count) {
echo '
<li>
<span class="beds">'.get_post_meta($p_id, 'bedrooms', true).'</span>
</li>';

I want the span tag to show <strong>ONLY</strong> if bedrooms custom field is <strong>NOT empty</strong>, dont know how to add if/else statement inside an echo statement. So any help would be greatly appreciated