I’m using the following code to display a custom value. The custom value being ‘website’
<?php
$custom_fields = get_post_custom($post_id); //Current post id
$my_custom_field = $custom_fields['website']; //key name
foreach ( $my_custom_field as $key => $value )
echo $key . " => <a href='" . $value . "'>Click Here</a><br />";
?>
However, before the ‘Click here’ i’d like to include another custom value, thumb.
So the output would be:
Value of custom field thumb
Value of custom field website
Thanks.
How about:
The
get_post_meta()
function is ideal when you know ahead-of-time the names of the fields you want to retrieve. Setting the third parameter totrue
tells it that you want to return a single value, and not an array of values (it’s possible to set multiple values using the same meta key, and get an array of values back).