Skip to content

Instantly share code, notes, and snippets.

@yuriinalivaiko
Last active October 26, 2023 11:31
Show Gist options
  • Save yuriinalivaiko/de017b83de571fb0415ebe7351d8abeb to your computer and use it in GitHub Desktop.
Save yuriinalivaiko/de017b83de571fb0415ebe7351d8abeb to your computer and use it in GitHub Desktop.
This code snippet uses the Map ID to customize the map styles in the User Locations extension.
<?php
/**
* Use Map ID to customize the user location map.
*/
add_action( 'wp_footer', function () {
?><script type="text/javascript">
function um_user_locations_customize_mapId( args, hash, directory ) {
args.mapId = 'YOUR_MAP_ID';
return args;
}
// customize the map in the member directory.
wp.hooks.addFilter( 'um_user_locations_map_args_init', 'um_user_locations', um_user_locations_customize_mapId );
// customize the map in profiles.
wp.hooks.addFilter( 'um_user_locations_map_field_args_init', 'um_user_locations', um_user_locations_customize_mapId );
</script><?php
}, 20 );
@yuriinalivaiko
Copy link
Author

This gist is a part of the article User Locations - Hooks.
Related article - Use Map IDs.

You can add this code to the functions.php file in the active theme directory. Skip the opening <?php tag.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment