How to get custom field value in WordPress
How to get custom field value in WordPress
<?php $zip_code = get_post_meta($post->ID, "zipcode", true); echo $zip_code; ?>
Get image url of custom file field
$client_image_url = '';
if(get_post_meta($query[$i]->ID, 'client_image', true)){
$client_image = get_page(get_post_meta($query[$i]->ID, 'client_image', true));
$client_image_url = $client_image->guid;
$client_image_url = $client_image->guid;
}and display image:
<?php if(!empty($client_image_url)){
echo '<img src="'.$client_image_url.'"/>';
}
?>
Post a Comment