I want to list all the values of a custom metabox in a custom post type.
Here is the code to get the one meta box in a single post
<?php echo get_post_meta($post->ID, 'institution_location', true);?>
but say I want to list all the meta boxes in the home page or a dropdown menu in a search form not just in a single page
the metabox code
add_meta_box(
'Location_metabox',
__( 'Location ', 'twentyeleven' ),
'institution_location_metabox_output',
'institution',
'side'
);
I tried to use WP_Query and it works fine.
Try using get_post_custom, that will return an array of all meta values linked to the post