You can use the Hook oum_locations_bubble_content to manipulate the content of the info bubbles of locations.
Insert the following PHP code in the functions.php of your theme:
add_filter('oum_location_bubble_content', function ( $content, $location ) {
// extend or change content
$content .= 'Post ID: ' . $location['post_id'];
return $content;
}, 10, 2);
To add a value from default fields edit this line:
add_filter('oum_location_bubble_content', function ( $content, $location ) {
// extend or change content
$content .= $location['post_id']; // use post_id, date, name, address, lat, lng, text, audio
return $content;
}, 10, 2);
To display the images of a location use $location[‘images’]. Pay attention that images are stored in the form of an array:
add_filter('oum_location_bubble_content', function ( $content, $location ) {
foreach ( $location['images'] as $image_url ) {
$content .= '<img src="' . $image_url . '">';
}
return $content;
}, 10, 2);
You can also display all location images as slider. The following code will return the images in the form of an interactive gallery:
add_filter('oum_location_bubble_content', function ( $content, $location ) {
// extend or change content
$content .= oum_get_location_value('images', $location['post_id']); // IMPORTANT: For Open User Map older than v1.4.9 use 'image' instead of 'images'
return $content;
}, 10, 2);
And to display a value from a custom field use this code:
add_filter('oum_location_bubble_content', function ( $content, $location ) {
// extend or change content
$content .= oum_get_location_value('CUSTOM FIELD LABEL', $location['post_id']);
return $content;
}, 10, 2);
Change CUSTOM FIELD LABEL to the name of your custom field.
Flag/Report locations
Here is how you can add a simple Flag button (Remove Location) that sends an email with the corresponding location ID to your inbox:
add_filter('oum_location_bubble_content', function ( $content, $location ) {
// extend or change content
$sendto = '[email protected]';
$subject = 'Please remove the Location with ID ' . $location['post_id'];
$content .= '<div class="oum_location_text"><a href="mailto:' . $sendto . '?subject=' . urlencode($subject) . '">Flag Location</a></div>';
return $content;
}, 10, 2);
Hint: To remove the existing content from the bubble add this line at first:
add_filter('oum_location_bubble_content', function ( $content, $location ) {
// extend or change content
$content = '';
$content .= 'Post ID: ' . $location['post_id'];
return $content;
}, 10, 2);