How to add multiple markers on the google map, at a certain meta_key and meta_value

I have over 200 customposts and each has customfields (add_city, add_state, add_location) in each custompost is googlmap with customfield (geo_longitude geo_latitude) Help please, display in googlmap multiple markers, depending on more meta_key meta_value.
To sort kustomposts I use this beautiful code :

<?php $args = array(
'meta_query'=> array(
    array(
        'key' => 'add_state',
        'value'=> 'ill'
    ),
           array(
                    'key' => 'add_city',
                    'value' => 'chicago'
     ))); $posts = query_posts($args); ?>

On the details page, I use this code for googlmap:

Read More
<?php
        $add_arr = array();
        if(get_post_meta($post->ID,'address',true))
        {
            $add_arr[] = get_post_meta($post->ID,'address',true);
        }
        if(get_post_meta($post->ID,'add_city',true))
        {
            $add_arr[] = get_post_meta($post->ID,'add_city',true);
        }
        if(get_post_meta($post->ID,'add_state',true))
        {
            $add_arr[] = get_post_meta($post->ID,'add_state',true);
        }

        $add_str = '';
        if($add_arr)
        {
            $add_str = implode(',',$add_arr);
        }
        if($add_str)
        {
            $geo_longitude = get_post_meta($post->ID,'geo_longitude',true);
            $geo_latitude = get_post_meta($post->ID,'geo_latitude',true);
        ?>
    <div class="propertymap">


             <?php if($geo_longitude &&  $geo_latitude){

                    require_once (TEMPLATEPATH . '/library/map/preview_map.php');
                    preview_address_google_map($geo_latitude,$geo_longitude,$add_str);
            }else{?>
            <iframe src="http://maps.google.com/maps?f=q&source=s_q&hl=en&geocode=&q=<?php echo $add_str;?>&ie=UTF8&z=14&iwloc=A&output=embed" height="358" width="239" scrolling="no" frameborder="0" ></iframe>
            <?php }?></div>

Then I created a page and a lot of time trying to string any of these codes.
He received only a white screen.
Please help me solve this puzzle !!!

Related posts

Leave a Reply

3 comments