querying a custom field

i am not sure that this is place you should change the shortcode

This code retrieves several values and not one..
as i understand it you are looking to get one value back right ?

that’s much simpler and doesen’t require the use of “foreach”

you simply put this in the desired location

<?php echo get_post_meta($post->ID, 'restaurants', true); ?>

EDIT 1

To get a custom field value inside the loop:

$key="mykey"; 
echo get_post_meta($post->ID, $key, true);

.

to get a custom field value outside the loop:

global $wp_query;
$postid = $wp_query->post->ID;
$key="mykey";
echo  get_post_meta($postid, $key, true);
  • in both case the key is the custom field name…