WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have made a custom search for houses.

The problem is that I have to show in the search results page, a "googlemaps" with the points at which there is a house, according to the search results obtained.

How can I do it?


share|improve this question

@Richard, it's hard to answer this in detail with this little details. Do you need to pinpoint a single house? Will you use an address or will you use latitude and longitude?

My suggestion would be to take a look at this excellent Google Maps Plugin for jQuery. jQuery is part of any WordPress installation, so you wouldn't need to install anything else. Additionally this is quite easy to load.

Below a quick example of how I've implemented this, using custom fields to store both a latitude and a longitude. But you could just as well get an address returned as a search result and add that:

    <!--Map implementation-->
//Quick conditional to make sure I don't show maps on items where no two coordinates are available  
        if (($wtr_latitude) && ($wtr_longitude)) { ?>
<div id="map" style="width:680px; height: 203px; background-color:grey;"></div>   
<script type="text/JavaScript">                                                     
          controls: false,
                  scrollwheel: false,
                      controls:               ["GSmallZoomControl3D", "GScaleControl"],
                      maptype: G_PHYSICAL_MAP,
                  markers: [{ latitude: "<?php echo $latitude; ?>",
                              longitude: "<?php echo $longitude; ?>",
                              popup: false }],
                          zoom: 10 });              
 <?php } ?>
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.