Get custom field outside the WordPress loop
Do you want to get a custom field outside the WordPress loop (e.g. in your sidebar) and you have no idea how? The following code snippet will help you do it.
* Replace the ‘customField’ in the 4th line with the name of your custom field.
$postid = $wp_query->post->ID;
echo get_post_meta($postid, 'customField', true);