Skip to content

Instantly share code, notes, and snippets.

@denisbaranov
Last active September 18, 2021 12:03
Show Gist options
  • Save denisbaranov/dd677d15064d26c0d299f49de58a4d42 to your computer and use it in GitHub Desktop.
Save denisbaranov/dd677d15064d26c0d299f49de58a4d42 to your computer and use it in GitHub Desktop.
You can find some code samples for using hooks in the extension User Locations
<?php
/**
* Disable Clustering
* You may add this code to the file functions.php in the active theme directory.
*
* @author Ultimate Member support <support@ultimatemember.com>
* @link https://ultimatemember.com/extensions/user-locations/
*/
add_action( 'wp_footer', function () {
if ( function_exists( 'UM' ) ) {
?><script type="text/javascript">
wp.hooks.addFilter( 'um_member_directory_disable_clustering', 'um_user_locations', function ( disableClustering, directory ) {
disableClustering = true;
return disableClustering;
}, 20 );
</script><?php
}
}, 20 );
<?php
/**
* Change the map marker title
* You may add this code to the file functions.php in the active theme directory.
*
* @author Ultimate Member support <support@ultimatemember.com>
* @link https://ultimatemember.com/extensions/user-locations/
*/
add_action( 'wp_footer', function () {
if ( function_exists( 'UM' ) ) {
?><script type="text/javascript">
wp.hooks.addFilter('um_user_locations_marker_data', 'um_user_locations', function (marker_data, hash, userdata) {
marker_data.title = userdata.display_name;
return marker_data;
}, 20);
</script><?php
}
}, 20 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment