I have to make a search form where i have to populate a select by the states of custom posts types. Some of them have the same state, then I would like to group-by to have a
I had to make a few improvements to Chirag Patels Code, to get it working:
postmeta . '.meta_value '; } ?> 'observatoire', 'post_status' => 'publish', 'posts_per_page' => -1, 'meta_key' => 'state' )); ?> have_posts() ) : $states->the_post(); echo "".reset(get_post_custom_values('state')).""; endwhile; ?>