Custom field
-
Hi, I’m currently displaying a custom field within a div tag, the problem is when there’s no value within the custom field, the div tag is still displayed with no value.
Here’s my code
<div id="title"><?php $key="title"; echo get_post_meta($post->ID, $key, true); ?></div>
Is there a way to only display the div tag if there is a value within the custom field? if that makes sense
Cheers
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Custom field’ is closed to new replies.