1. Home
  2. Knowledge Base
  3. Customization
  4. Change or extend content of each location bubble

Change or extend content of each location bubble

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:

PHP
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:

PHP
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, image, audio

    return $content;

}, 10, 2);

And to add a value from a custom field:

PHP
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:

PHP
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:

PHP
add_filter('oum_location_bubble_content', function ( $content, $location ) {

    // extend or change content
    
    $content = '';

    $content .= 'Post ID: ' . $location['post_id'];

    return $content;

}, 10, 2);
Was this article helpful?

Related Articles

Need Support?

Can't find the answer you're looking for?
Contact Support

EN