Google Maps Purchased Plugin - Is it possible to place Custom Fields from map in another location in

I need to know how to do the following:
1. Place address used in map in another place on page template.
2. Customize the Details box for each icon. For example, change the word "Posts" to "Sites"
3. Do not display description box below map, but still show posts associated to map icon once you click on it.

I know how to edit the php etc.

  • PC
    • WPMU DEV Initiate

    Hey Lena,

    Greetings and thanks for posting on the forums.

    It looks like this one will need some custom work to be achieved. Let me look into it more deeply and get back to you with more information on the same.

    Cheers, PC

  • Vladislav
    • Dead Eye Dev


    The first point, reusing the existing map, is entirely possible using our shortcode. If you want to use it in the theme template, you can use the do_shortcode PHP call to process it. There is a couple of ways you could go about doing this, depending on whether the map has been associated with a post or not. If it has, you can make use of the query attribute, e.g. like this:

    <?php echo do_shortcode('[map query="p=471"]'); ?>

    ... where 471 is an example of the post ID your map has been associated with. Alternatively, you could use the map ID directly, like so:

    <?php echo do_shortcode('[map id="1"]'); ?>

    You can get the map ID and the entire shortcode you want to use by finding the map you want to use in the insert map interface, then inserting it into a post. You can then just copy that shortcode and paste it in the do_shortcode call.

    As for not showing the description box below the map, currently your best bet could be hiding it. You can do this by adding a bit of custom CSS, e.g. like so:

    .agm_mh_marker_list { display: none; }

    You can add this into the "Additional CSS" field in Settings > Google Maps.

    Lastly, about customizing the the Details box, I'm not sure I got what you meant by that. Could you please be a bit more specific? Generally speaking, though, pretty much all the strings in the plugin are exposed for translation, so you could change any one of them by generating a custom translation to English. Alternatively, you could also use the Ultimate Branding plugin to change the language instead.

  • dandi-admin
    • New Recruit

    Thank you for your quick response, I appreciate it, unfortunately I didn't get the answers I was looking for. Let me try to rephrase as I see the confusion.

    First of all, I understand that I can hide the marker list with CSS, thank you for clarifying that that is the only way.

    As for the part about the shortcode. I am actually already using the shortcode feature which is nice, but my main goal was to extract info being use for the map in another location, not in a map. To be more specific, I have a map at the bottom of a post, but I want to list the address text at the top of the post and didn't want the client to have to input it twice. I thought there might be a way to display the "description" and "title" from the map details separate from the map itself. I realize that is already happening with the marker list, but is there a way for me to dissect those pieces separately with php to place them where I need them?

    As for the last part about customizing the description, I do not wish to translate it, I just wanted to perhaps delete the name "posts" or give that a more descriptive name. To be clear, I am talking about the heading "posts" that then lists the posts associated to that location. I can keep searching where that is being called in the php plugin files.

    I really appreciate your timely responses.


  • oscar_rottink
    • New Recruit

    Don't want to interupt too much but maybe also usefull for Lena (and not important enough for a new topic).

    Is there a way you can track when the map is loaded and then call some jQuery to customize things? Might help Lena as well because than you could get variables from an already loaded map and use them.

  • Vladislav
    • Dead Eye Dev


    @Lena, thank you very much for the clarification, I think I get much better now what you're after. If you're OK with putting together some custom code, you can make use of the plugin's model class to get to the map data you need. Internally, each map has an array of markers, and each marker is a hash containing keys for icon, title, body and location. Having this in mind, you could e.g. list all markers for a map in a list using something like this:

    $map_id = 1;
    if (class_exists('AgmMapModel')) {
    	$model = new AgmMapModel;
    	$map = $model->get_map($map_id);
    	$markers = !empty($map['markers']) ? $map['markers'] : array();
    	if (!empty($markers)) {
    		echo '<ul>';
    		foreach ($markers as $marker) {
    			echo '<li>';
    			echo $marker['title'] . '&nbsp;' . $marker['body'];
    			echo '</li>';
    		echo '</ul>';

    The $map_id variable at the top is the ID of the map we want to use. Of course, using the same class we could get to any other kind of map, including querying the posts for associated maps. The class itself is located in lib/class_agm_map_model.php and is fairly commented, so if you need to make use of some other methods perhaps having a peek there could help - or I can help with some sample code, too.

    As for the javascript interaction, that is possible too (also a very good point, thank you @oscar_rottink :slight_smile: - the plugin exposes quite a few custom jQuery events, and we also use them internally, in our add-ons. If you lean more towards the javascript approach, the most basic event you may want to listen for is "agm_google_maps-user-map_initialized", which is fired once per map on the page. You could subscribe to it e.g. like this, for a map with ID 49:

    <span id="marker-output"></span>
    (function ($) {
    $(document).on("agm_google_maps-user-map_initialized", function (e, map, data, markers) {
    	if (!markers.length) return false;
    	if (! || parseInt(, 10) !== 49) return false;
  • oscar_rottink
    • New Recruit

    @Vladislav thanks! one way or the other that's a useful post! Especially because I'm more a design guy than a programmer. But love to sort things out and puzzle.

    Sorry little question, I'm trying like crazy to load my custom script below those of the Maps plugin but must doing something wrong. Can you give me small kick in the right direction?

  • dandi-admin
    • New Recruit

    @Vladislav I didn't quite understand that second part. No worries, I just decided to hide the word "posts" in CSS.

    That first part was exactly what I needed so that the client did not have to enter the content twice as I need to display the text address in another place on that page.

    Thank you for your response and it was just in time!

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.